2

我有一个注册页面,在我的本地主机上运行良好。当用户提交表单时,它将获得操作页面并处理注册,并在成功提交后将用户重定向到确认页面。

但是在服务器中,当用户提交表单时,它会转到操作页面并一次又一次地重新加载,但没有任何反应。

我正在使用 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>

提前致谢

4

1 回答 1

0

据我了解,您创建的代码应该重新加载。javascript代码负责重定向。确保您的 javascript 没有出错。看看提交后的结果代码会不会和你预期的一样。如果一切正常,请尝试手动运行thankyou.php。就像是

http://domain/thankyou.php.
于 2013-04-19T02:21:57.380 回答