当我没有输入用户名或者密码时,为什么不能提示用户名或者密码不能为空???
用户名或者密码不能为空 if(isset($_POST['Submit'])&&$_POST['Submit']=="登录"){
$user=$_POST['user'];
$pass=$_POST['pass'];
if(empty($user)||empty($pass)){
echo "
alert('用户名或者密码不能为空');";
}
}
?>
回复讨论(解决方案)
echo "alert('用户名或者密码不能为空');";
写错了
应该是<script></script>
metho都没有写、
你不是 post 方式提交的,自然不能通过 $_POST 验证
if(isset($_POST['Submit'])&&$_POST['Submit']=="登录"){
$user=$_POST['user'];
$pass=$_POST['pass'];
if(empty($user)||empty($pass)){
echo "<script>alert('用户名或者密码不能为空');</script>";
}
}
?>
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn