-1
我有一個頁面,它將輸入到上一頁中的數據輸入到數據庫中。然後它獲取該帖子的數據庫ID。我想在標題中使用這個id($ id),但是當我運行下面的代碼時,get變量是空的。PHP標題不重定向獲取變量
CODE:
<?php header("Location: http://localhost/biology/question.php?q=$id"); ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<?php
include '../connect.php';
if (isset($_POST['questionSubmit'])){
$question=mysql_real_escape_string($_POST['question']);
$detail=mysql_real_escape_string($_POST['detail']);
$date=date("d M Y");
$time=time();
$user=$_SESSION['id'];
$put=mysql_query("INSERT INTO questions VALUES ('','$question','$detail','$date','$time','$user','biology','0')");
$id=mysql_insert_id();
}
?>
</body>
</html>
是mysql_query()做它的工作(它插入行)? – 2011-12-29 04:34:48