有一个烦人的小问题。找不到有效的解决方案,我尝试了从这里和谷歌搜索中找到的所有东西。
这样做的目的是将它们传递到先前创建的“房间”中。
似乎我尝试什么都没关系,我无法使用带有href的onclick将它加载到另一个页面中。而且我知道它很容易解决它只是我想不到的愚蠢。
抱歉,如果我没有正确地发布我的代码,这是我第一次问一个问题,我通常只是潜伏在周围寻找答案。
//..Left out <?php and my connect info but it is in my script
//--CLEANUP MY MESS
$sql = "SHOW TABLES";
$result = mysql_query($sql) or die('err11');
while ($row = mysql_fetch_row($result)) $testing[$row[0]] = true;// Gets a list of tables in the database and turns them into a handy format
if ($testing['prim']){// Checks to see if table prim exists
$sql = "SELECT * FROM prim"; // Pulling all info again after cleaning
$result = mysql_query($sql) or die('err11');
$_e = '';
while ($row = mysql_fetch_assoc($result)){// Cycle through enteries to see what rooms are up
$_e = $_e . "<a href='' onclick='join(" . $row['room'] . ");'>" . $row['teach'] ."</a><br>";
}
}else $_e = "Sorry no rooms are open";
mysql_close($con);
?>
<!DOCTYPE html>
<html>
<head>
<script>
function join(er) {
alert('ffs is this even firing');//this is a debug statement i was using... it was firing
//THE LINE BELOW DOES NOT SEEM TO WORK
document.location = "http://***late edit to get rid of the web address lol sorry***start.php?name=" + document.getElementById("name").value + "&room=" + er;
//THE LINE ABOVE DOES NOT WORK
}
</script>
<title>Portal</title>
</head>
<body>
Name:<input type="text" id='name' name="name"><br><?php echo $_e ?>
</body>
</html>
我尝试了许多不同的小变化,比如 window.location window.location.href 等等等等。也弄乱了退货,只是让我发疯 感谢任何帮助,你们度过了愉快的一天