In PHP I have used:
if($a=="no" or $curriculum=="yes")
Do you find anything wrong with that if
statement?
It displays the contents of if
even when $a = yes
and $curriculum = no
.. I have done enough checks to check whether the variables have the correct value.. Please help!!
you can try this
if($a=="no" || $curriculum=="yes")
Alright, here are some tests. Your if statement is fine ( or
works as well as ||
does in this case )
$a = 'abc';
$curriculum = 'abc';
if($a == "no" or $curriculum == "yes") {
echo 'Either $a equals "no" or $curriculum equals "yes"<br>'.PHP_EOL;
} else {
echo 'Neither $a equals "no" nor does $curriculum equal "yes"<br>'.PHP_EOL;
}
$a = 'no';
$curriculum = 'abc';
if($a == "no" or $curriculum == "yes") {
echo 'Either $a equals "no" or $curriculum equals "yes"<br>'.PHP_EOL;
} else {
echo 'Neither $a equals "no" nor does $curriculum equal "yes"<br>'.PHP_EOL;
}
$a = 'abc';
$curriculum = 'yes';
if($a == "no" or $curriculum == "yes") {
echo 'Either $a equals "no" or $curriculum equals "yes"<br>'.PHP_EOL;
} else {
echo 'Neither $a equals "no" nor does $curriculum equal "yes"<br>'.PHP_EOL;
}
These result in:
Neither $a equals "no" nor does $curriculum equal "yes"
Either $a equals "no" or $curriculum equals "yes"
Either $a equals "no" or $curriculum equals "yes"
Please do a var_dump of both variables right before the if statement and show us the results:
var_dump($a);
var_dump($curriculum);
if($a == "no" or $curriculum == "yes") {