簡體   English   中英

表單提交(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>

我的login.php:

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

我甚至沒有看到'測試'也沒有看到任何錯誤......

它實際上不是一個PHP問題。 假設您正在使用JQuery mobile。 禁用data-ajax可能會有所幫助。

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

在您的html頁面上使用此代碼。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM