-2
我想登录,但似乎我的变量不包含anthing。 我以前遇到过这个问题,但我设法解决这个问题,名称属性在我的HTML表单中缺少时间..但这次不知道我在哪里做错了.plz帮助?
这里是我的html代码片段。其返回空白即使我提出:
<form action="onlogin.php" method="post">
<h1>Login Form</h1>
<div>
<input type="text" placeholder="Username" required="" name="username" />
</div>
<div>
<input type="password" placeholder="Password" required="" name="password" />
</div>
<div>
<input type="submit" value="Log in" />
<a href="#">Lost your password?</a>
<a href="signup.html">Register</a>
</div>
</form>
和我的PHP代码段为:
<?php
include ("config/config.php");//connects to db successfully
if(isset($_POST["submit"]))
{
$username = $_POST['username']; echo "$username";
$password = $_POST['password']; echo "$password";
}
?>***
你没有$ _ POST [ '提交'],你可以检查,如果(isset($ _ POST [ '用户名'])),而不是 –
thankuu这么多... 。现在它工作正常.. – Rani