Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k 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 Answer

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)){

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...