我目前正在学习网页设计(HTML,PHP,Javascript),我已经创建了我自己的网站一个名为MySite.html的文件。我有一个登录屏幕,它使用POST方法将数据发送到一个名为signing .php的文件。现在它有一个简单的检查来确认是否输入了数据。但是当我输入用户名和密码时,脚本告诉我没有输入任何东西。下面是代码----->
<form name="signin" action="signin.php" method="POST">
<p><input type="text" id="username" placeholder="Enter Username"></p>
<p>
<input type="password" id="pass" placeholder="Password">
<input type="submit" id="sgnin" value="Sign In">
</p>
<p id="small">
<input type="checkbox" id="rem">Remember me.Forgot password?
</p>
<span><p> </p>
</form>
php脚本——>
<?php
if(isset($_POST['username']) && isset($_POST['pass']) && !empty($_POST['username']) && !empty($_POST['pass'])){
echo 'Logged In';
}else die("enter something");
?>
请帮忙!
你不能给你的表单元素name属性给它像这样
<input type="text" id="username" placeholder="Enter Username" name="username">
和
<input type="password" id="pass" placeholder="Password" name="pass">