Click to See Complete Forum and Search --> : [RESOLVED] If statement


comptech520
02-25-2006, 05:15 AM
Hello,

Here is a statement that I cant seem to get to work.

heres the psudo

if photo web = yes then
show whatsnew.php
else
show nothing

How can I get this working?


<? if($user_data['photoWeb']){ ?>
<div class="box">
<?php include('whatsnew.php'); ?>
</div>
</div>
<? }else{ ?>
<? } ?>

chickenland
02-25-2006, 05:29 AM
Depends on your apache configuration, but short tags might be throwing it. try full <?php and ?>

also if($foo['bar']){ only checks that $foo['bar'] exists (and doesn't do a brilliant job of that... if you actually want to make sure it = yes, then use

if($foo['bar'] == "yes"){

also, try echoing $foo before you test it in the if condition, just to check its holding the value you assume it is.

Are you getting any specific error messages ?

comptech520
02-25-2006, 05:47 AM
My appologies, I messed up. I photoweb = yes, then </div> if photoweb = no, than show whatsnew.php

Whats the way to do this:

else and $user_date['EventType'] is NOT wedding then show whatsnew.php

So if the else statement is being used and the event type is not wedding show whats new.php

<?php if($user_data['photoWeb']){ ?>
</div>
<?php }else{ ?>
<div class="box">
<?php include('whatsnew.php'); ?>
</div>
</div>
<?php } ?>