Page 1 of 1

[SOLVED] Checking condition using 'if'...

Posted: Tue Jul 06, 2004 2:18 pm
by dardsemail
I have a bit of code and I'm trying to use a conditional 'if' statement to check its value - unfortunately, I think I'm setting its value instead.

Here's the code:

Code: Select all

<?php
if ($_SESSION['state']=='LA')

?>
Am I setting the 'state' value or checking it? Its weird because I'm storing the $_SESSION value for 'state', but when I get to this page, it switches back to 'LA' no matter what I have entered on the previous pages to set it. That's why I suspect that this code is kind of iffy.

Am I checking the variable against 'LA' or setting it? Ideally, I'd like to just check it.

Thanks!

Posted: Tue Jul 06, 2004 2:29 pm
by markl999
== is a comparison
= is an assignment
So you are comparing.

Do you have register_globals On? (a <?php phpinfo() ?. page will tell you.
If you do it would explain your problem.

Posted: Tue Jul 06, 2004 2:39 pm
by dardsemail
Thanks. Got it. Its working now.