2013-11-20 75 views
0

我有一个简单的登录页面,有2个文本框和一个按钮。当我按“提交”时,URL变成了php页面,但我完全没有看到。我不知道如何解决它,所以我希望有人能帮助我。表单提交(POST)到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"); 
?> 

我甚至不看 '测试',也没有任何错误...

+1

在'session_start()'之前放置一个回显。如果你甚至没有看到,那么在脚本能够达到其他代码之前就会杀死脚本。 ini_set/reporting的更改应该在php.ini级别进行,所以当脚本尝试启动时它们才会生效。尝试在启动后更改它们是没有意义的,如果这是一个启动错误,则会导致其他操作无效。 –

+0

@MarcB正在做些什么......确保你在php.ini中设置了['error_log'](http://us2.php.net/manual/en/errorfunc.configuration.php#ini.error-log)所以你至少可以得到致命的启动错误(和其他)。 –

+0

尝试回显“在回声前删除3行之后进行测试,并逐一添加每行并查看哪一个导致问题,如果仍然不起作用,则意味着其他事件导致脚本根本不运行。 – Justin

回答

2

它实际上不一个PHP的问题。假设您正在使用JQuery移动。禁用data-ajax可能会有所帮助。

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

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

+0

究竟在哪里?我已经尝试了头部和身体,但没有用。 – Joetjah

+0

之前

+0

我在头部和身体两方面都测试过了,它不起作用。 @Joetjah [见我的评论](http://stackoverflow.com/questions/20107541/form-submit-post-to-php-page-gives-blank-page-unless-i-refresh#comment29962198_20107541) –