Chris Andrews
asked on
why a parse error on this if/else?
Why am I getting a parse error on this?
<? if ($_SESSION['g_id']) { ?>
this <?} ?>
<? else { ?>
that <? } ?>
I'm trying to adapt someone else's script and I don't usually write things like this. The if statement alone works (that was the original script), but when I add the else portion (what I am trying to do) I get a parse error on that line. Can you tell me where I am going wrong with this?
Thanks, Chris
<? if ($_SESSION['g_id']) { ?>
this <?} ?>
<? else { ?>
that <? } ?>
I'm trying to adapt someone else's script and I don't usually write things like this. The if statement alone works (that was the original script), but when I add the else portion (what I am trying to do) I get a parse error on that line. Can you tell me where I am going wrong with this?
Thanks, Chris
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I don't know why moving that bracket from the php tag it was in to the other makes a difference, but like I said, I don't usually write (what little code I know how to write) like that, will have to learn more on this subject :)
Thank you both, Chris
Thank you both, Chris
<? if ($_SESSION['g_id']) { ?>
this
<? } ?>
<? } else { ?>
that <? } ?>