VERY strange variable value check [solved]
Posted: Wed Jun 15, 2005 12:37 am
Hello all,
I have a long piece of code that works through a bunch of problems, and if a problem is correct, it assigns the variable $pass to true, if it's incorrect it assigns it to false.
The idea being at the end of the script, we know if the user passed or not (true or false).
I'll post a snippet here, as well as some output, and I tell you what, I'm baffled.
The snippit:
and the output:
Now excuse me here
but if $pass is set to true (as stated in the check before the if then else, then why oh why is it executing the if pass = false code?!
I'm... going mad I think
Perhaps some fresh eyes?
I have a long piece of code that works through a bunch of problems, and if a problem is correct, it assigns the variable $pass to true, if it's incorrect it assigns it to false.
The idea being at the end of the script, we know if the user passed or not (true or false).
I'll post a snippet here, as well as some output, and I tell you what, I'm baffled.
The snippit:
Code: Select all
//If all checks above went badly, then let the user know what they did wrong
/* ********************************************************************** */
echo "<br><br>pass is now finally set to $pass<br><br>";
if ($pass = "false")
{
echo "<table width=\"50%\" border=\"0\" cellpadding=\"5\" cellspacing=\"10\" align=\"center\"><tr><td class=\"error_box\" align=\"center\">";
echo "Attention!<br>You have not answered all the questions, please scroll down, look for the red errors and fill in those questions.<br>Thank you.";
echo "</td></tr></table>";
}
//Else let the user know they did well (or at least just process the info
elseif ($pass = "true")
{
echo "All checks passed, you can continue...<br>";
}Code: Select all
pass is now finally set to true
Attention!
You have not answered all the questions, please scroll down, look for the red errors and fill in those questions.
Thank you.I'm... going mad I think
Perhaps some fresh eyes?