Link to home
Start Free TrialLog in
Avatar of Chris Andrews
Chris AndrewsFlag for United States of America

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
Avatar of steelseth12
steelseth12
Flag of Cyprus image

You are missing a } on the else

<? if ($_SESSION['g_id']) { ?>
     
      this        
     
      <? } ?>
<? } else { ?>      
      that  <? } ?>
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Chris Andrews

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