表单提交(POST)到php页面会给出空白页面,除非我刷新


Form submit (POST) to php page gives blank page unless I refresh

我有一个简单的登录页面,包含2个文本字段和一个按钮。当我按下"提交"时,URL会更改为php页面,但我完全看不到任何内容。我不知道该怎么修,所以我希望有人能帮我。

我的HTML页面:

<!DOCTYPE html>
<html>
    <head>
        <title>Login</title>
                <link rel="stylesheet" href="style2.css" />
        <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
        <meta content="utf-8" http-equiv="encoding">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
        <link rel="stylesheet" href="themes/customtheme.css" />
        <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
        <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
    </head>
    <body>
        <div data-role="page">
            <div data-role="header">
                <a class="ui-btn-left" href="index.html" data-icon="back">Back</a>
                <h1><span>Login</span></h1>
                <a class="ui-btn-right" href="#" data-icon="info">i & &euro;</a>
            </div>
            <div data-role="content" data-position="relative">
                <div class="loginform">
                    <form id="loginForm" action="login.php" method="POST">
                        <span>Email adress:</span>
                        <input type="text" name="email" id="email"></input>
                        <span>Password:</span>
                        <input type="password" name="password" id="password"></input>
                        <input type="submit" value="Login" />
                    </form>
                </div>
            </div>
            <div data-role="footer" data-position="fixed"></div>
        </div>
    </body>
</html>

和我的登录php:

<?php session_start();
    error_reporting(E_ALL);
    ini_set('display_errors',TRUE);
    ini_set('display_startup_errors',TRUE); 
    echo ("Test");
?>

我甚至没有看到"测试",也没有任何错误。。。

这实际上不是php问题。假设您使用的是JQuery手机。禁用data-ajax可能会有所帮助。

<script type="text/javascript">
$(document).bind("mobileinit", function () {
    $.mobile.ajaxEnabled = false;
});
</script>

在您的html页面上使用此代码。