Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

PHP Login System Error On Line 51?

I'm creating a login system for a site I'm developing and this error appears when I enter a password into the password field:

Notice: Undefined variable: password in C:xampphtdocsmyfileslogin.php on line 51 you must enter your password

This is the code on line 51: if ($password){

This is some of the code surrounding the line:

Line 50: if ($user){

Other code surrounding the line:

echo "$user - $password <hr /> $form";
}
else
echo "you must enter your password $form";

}
else
echo "you must enter your username $form";

}
else
echo $form;

Anyone know what the problem is or could be?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Well, the only reason you're getting this error, is because you variable isn't defined. Try to use isset(), so:

if (isset($user) && isset($password)){

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...