Page 1 of 1

swap NZ for AZ but it wont print out after the IF statment

Posted: Mon Nov 11, 2002 6:48 am
by adrian28
<?
if ($test=='AM') {
$test='NZ'; //the swap
echo $test; //prints the value 'NZ' to the screen
} ?>

Posted: Mon Nov 11, 2002 6:50 am
by twigletmac
If you're testing for 'AZ' then you probably need to change this:

Code: Select all

if ($test=='AM') {
to this:

Code: Select all

if ($test == 'AZ') {
Mac

Posted: Mon Nov 11, 2002 6:57 am
by adrian28
I made a mistake with the subject line. Either way I cant get it to print out for me.

Posted: Mon Nov 11, 2002 7:00 am
by twigletmac
Have you echoed out $test before the loop to check it's as you expect? That's a pretty simple if conditional so if $test contains 'AM' then you shouldn't have any problems. If this is part of a larger loop or script then something else may be affecting what prints and what doesn't.

Mac