【发布时间】:2009-08-12 00:02:04
【问题描述】:
如何在 PHP 中获取 URL 中的变量到下一页?
用户在该网址
http://localhost/codes/index.php?ask_question&email=masi@gmail.com&passhash_md5=202cb962ac59075b964b07152d234b70
他发送了一个问题,然后转到以下网址,其中变量由于某种未知原因而丢失了它们的值。
http://localhost/codes/index.php?question_sent&email=&passhash_md5=
以下代码为代码handle_a_new_question.php。
$result = pg_prepare($dbconn, "query77", "INSERT INTO questions
(body, title, users_user_id)
VALUES ($1, $2, $3);");
$result = pg_execute($dbconn, "query77", array($body, $title, $user_id));
if(isset($result)) {
$header = ("Location: /codes/index.php?"
. "question_sent"
. "&"
. "email="
. $_GET['email'] // this seems to be correct to me
. "&"
. "passhash_md5="
. $_GET['passhash_md5'] // this seems to be correct to me too
);
header($header);
}
您发现代码中有任何错误吗?
【问题讨论】: