我有一个注册页面在我的localhost上工作正常。当用户提交表单时,它将获得操作页面并处理注册,成功提交后,它会将用户重定向到确认页面。
但是在服务器中,当用户提交表单时,它会转到操作页面,只是一次又一次地重新加载,但没有任何反应。
我正在使用php。
如果此论坛中的任何人已经遇到过这种情况,或者知道为什么会这样,请帮助我。我必须在服务器上传项目后立即交付项目。
代码:
require_once('conn.php');
$exp1 = $_POST["exp1"]; $exp2 = $_POST["exp2"];
$expdate = $exp1 . "/" . $exp2;
if ($_POST['hwno'] != 'BYOD') {
$shipadd = $_POST["shipadd1"] . " " . $_POST["shipadd2"] . ", " . $_POST["shipadd3"] . " " . $_POST["shipadd4"] . " " . $_POST["shipadd5"];
}
$shipname = $_POST["fname"] . " " . $_POST["lname"];
if($_POST["type"] != "satellite") {
$location = $_POST["dbcountry"] . " - " . $_POST["dbcity"] . ", " . $_POST["dbstate"];
$location2 = $_POST["dbcountry2"] . " - " . $_POST["dbcity2"] . ", " . $_POST["dbstate2"];
$lnum = $_POST["dblocalnum"];
$lnum2 = $_POST["dblocalnum2"];
} else {
$location = "none";
$location2 = "none";
$lnum = "none";
$lnum2 = "none";
}
$sfname = $_POST["fname"];
$slname = $_POST["lname"];
$sstreet = $_POST["street"];
$scity = $_POST["city"];
$sgtotal = $_POST["gtotal"];
if ($_POST['hwno'] != 'BYOD') {
$sshipmethod = $_POST["shipmethod"];
$query = "query here";
}
else {
$query = "query here";
}
$to = "email here";
$subject = "subject";
$message = "message hre";
$confirmationMail = mail ($to, $subject, $message, $from);
if(!$confirmationMail) {
echo "Something went wrong. Please try again";
}
$returnTo = "thankyou.php";
//echo $returnTo;
}
}
else {
echo "error writing to database";
}
?>
<html>
<head>
<script language="JavaScript">
document.location = "<?php echo $returnTo; ?>";
</script></head>
提前致谢
答案 0 :(得分:0)
根据我的理解,您创建的代码应该重新加载。 javascript代码负责重定向。确保您的javascript没有收到错误。查看提交后的结果代码是否符合您的预期。如果一切正常,请尝试手动运行thankyou.php。像
这样的东西http://domain/thankyou.php.