I am trying to compare two strings I get from a password form in HTML.
They are being stored in variables from $_POST. I print them out and they look the same, but the code below will never evaluate to true, only false. Why does that happen?
//Verify the passwords match
if( ($passwd != $pass_confirm) && ($new_email != $email_confirm) ){
echo "Email and/or password do not match";
return FALSE;
}
I appreciate any help.
For your code to show the error message, both the email and password must be wrong.
Try using
||instead of&&, so the error is shown when just one of them is wrong.