I'm trying to test for empty fields and stop them in a simple elegant manner but I can't figure out why this method doesn't work.
if($pw != $re-pw)
{
print "error: passwords do not match";
}
else if($username = "" || $pw = "" || $re-pw = "") //doesn't execute?
{
print "please fil out all fields";
}
else
{
//this executes
}
I've checked the php manual on if statements, it seems like this should work, but I'm not 100% sure. I'm also not sure if you are allowed to test if a variable = "" in php. I'm sorry if this is a dumb question, I haven't worked on php in years.
Aucun commentaire:
Enregistrer un commentaire