vendredi 22 février 2019

If $ isn't x or y

Can't get || to work in this comparison operation and I can't for the life of me understand why.

This works fine:

$validation = ($_POST["txtValidcode"]);
if($validation!=='ABC') { $strError .= 'Wrong';}

But this doesn't work at all (it treats both entries as wrong):

$validation = ($_POST["txtValidcode"]);
if($validation!=='ABC' || 'abc') { $strError .= 'Wrong';}

I've tried: or, !=, if($validation!=='ABC' || $validation!=='abc') and probably every other option I could think of. What am I doing wrong here?

Aucun commentaire:

Enregistrer un commentaire