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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
adrian28
Forum Newbie
Posts: 2
Joined: Mon Nov 11, 2002 6:48 am

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

Post by adrian28 »

<?
if ($test=='AM') {
$test='NZ'; //the swap
echo $test; //prints the value 'NZ' to the screen
} ?>
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
adrian28
Forum Newbie
Posts: 2
Joined: Mon Nov 11, 2002 6:48 am

Post by adrian28 »

I made a mistake with the subject line. Either way I cant get it to print out for me.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
Post Reply