Page 1 of 1
if statement not working
Posted: Wed Oct 13, 2010 10:29 am
by AdrenalineSeed
Code: Select all
<php? if ($tournyinfo['checkin'] == "NO") ?>
<option value = "NO" selected> Disabled</option>
<option value = "YES"> Enabled</option>
<php? endif; ?>
This is displaying the HTML within the if statement no matter what. Is my syntax wrong?

Re: if statement not working
Posted: Wed Oct 13, 2010 10:49 am
by califdon
If you're going to use the alternative syntax for "if" statements, you need to use a colon (:) after the "if" condition. See
http://php.net/manual/en/control-struct ... syntax.php
Re: if statement not working
Posted: Wed Oct 13, 2010 11:53 am
by AdrenalineSeed
Ok I tried adding the : and I still get those select values no matter what.
Code: Select all
<php? if ($tournyinfo['checkin'] == "NO"): ?>
<option value = "NO" selected> Disabled</option>
<option value = "YES"> Enabled</option>
<php? endif; ?>
Furthermore I tried this:
Code: Select all
<php? if (1==2): ?>
<option value = "NO" selected> Disabled</option>
<option value = "YES"> Enabled</option>
<php? endif; ?>
Re: if statement not working
Posted: Wed Oct 13, 2010 1:19 pm
by califdon
Oh, I just noticed that you have the <?php tag backwards. The question mark immediately follows the left angle bracket.
Re: if statement not working
Posted: Wed Oct 13, 2010 1:21 pm
by AdrenalineSeed
califdon wrote:Oh, I just noticed that you have the <?php tag backwards. The question mark immediately follows the left angle bracket.
OMG im such a N00b. Thanks!
BTW nice quantum physics joke in your sig

Re: if statement not working
Posted: Wed Oct 13, 2010 1:58 pm
by califdon
No problem. We always feel silly when we overlook the obvious, but we all do it sometimes.
Thanks. It was a toss-up between that and "The early bird may get the worm, but it's the second mouse that gets the cheese."
Runners-up included:
"I used to be indecisive. Now I'm not sure."
"You do not need a parachute to skydive. You only need a parachute to skydive twice."
"A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station."
"I asked God for a bike, but I know God doesn't work that way. So I stole a bike and asked for forgiveness."
"Light travels faster than sound. This is why some people appear bright until you hear them speak."
"I thought I wanted a career, turns out I just wanted pay checks."
"Why do Americans choose from just two people to run for president and 50 for Miss America?"
"I always take life with a grain of salt -- plus a slice of lime, and a shot of tequila."