mercredi 23 septembre 2020

I can't figure out what is wrong with this if statement in PHP? [duplicate]

I have built this if statement in PHP, but the else part of it is not showing any effects -

if($fcode=='Ok' || 'F') {
    $name = $_POST['udf1'];
    $email = $_POST['udf2'];
    $mobile = $_POST['udf3'];
    $city = $_POST['udf4'];
} else {
    $name = 'NA';
    $email = 'NA';
    $mobile = 'NA';
    $city = 'NA';
}

What I aim to do is, if the fcode variable's value is either of 'Ok' or 'F', get the POST parameters and store them into some variables ($name, $email, etc.). If it's not 'Ok' or 'F', store 'NA' into those variables.

What's happening is, the main if's code is working (when the fcode = Ok || F) as expected, but the else's code does not do anything.

Did I do anything wrong? What should I do now?

Any help is appreciated 😀 Thanks!

Aucun commentaire:

Enregistrer un commentaire