Joetjah
Joetjah

Reputation: 6132

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

I have a simple login page with 2 textfields and a button. When I press "Submit", the URL changes to the php page but I see absolutely nothing at all. I have no idea how to fix it so I'm hoping somebody can help me.

My HTML page:

<!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>

And my login.php:

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

I don't even see 'Test' nor any error...

Upvotes: 0

Views: 1882

Answers (1)

Md. Al-Amin
Md. Al-Amin

Reputation: 1441

Its actually not a php problem. Assume you are using JQuery mobile. Disabling data-ajax may help.

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

Use this code on your html page.

Upvotes: 2

Related Questions