Seniors help younger brother I look at the following code where the wrong
Source: Internet
Author: User
Seniors, help me see where the code is wrong.
When I do not enter a user name or password, why can not prompt the user name or password can not be empty???
<title>User name or password cannot be empty</title>
if (Isset ($_post[' submit ') &&$_post[' submit ']== "login") {
$user =$_post[' user '];
$pass =$_post[' pass ';
if (Empty ($user) | | Empty ($pass)) {
echo " alert (' User name or password cannot be null '); ";
}
}
?>
------Solution--------------------
echo " alert (' User name or password cannot be null '); ";
Wrong writing.
Should be
------Solution--------------------
You are not submitted by post, nature cannot be verified by $_post
------Solution--------------------
1.form without method= "POST"
2. Ought to be Submit"/>
3.echo " alert (' User name or password cannot be null '); "; Should be echo " ";
You can change that.
<title>User name or password cannot be empty</title>
if (Isset ($_post[' submit ') &&$_post[' submit ']== "login") {
$user =$_post[' user '];
$pass =$_post[' pass ';
if (Empty ($user)
------Solution--------------------
Empty ($pass)) {
echo "";
}
}
?>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.