【发布时间】:2013-11-20 21:36:54
【问题描述】:
我有一个带有 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 & €</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");
?>
我什至没有看到“测试”或任何错误...
【问题讨论】:
-
在
session_start()之前添加一个回声。如果您甚至没有看到这一点,那么在您的脚本到达其余代码之前,有些东西正在杀死您的脚本。 ini_set/reporting 更改应该在 php.ini 级别进行,因此它们在脚本尝试启动时生效。启动后尝试更改它们是没有意义的,如果它是一个启动错误杀死东西。 -
-
在删除 echo 之前的 3 行之后尝试 echoing "test 并逐行添加,看看是哪一行导致了问题。如果仍然无法正常工作,则意味着其他原因导致脚本根本不跑。
-
我测试了你的代码,它与你在
<head></head>中的 jQuery 有关,因为当我删除所有这些时,它会回显test -
我在 session_start 之前放置并回显,我什至没有看到...
标签: php html jquery-mobile form-submit