if and end if error

Discussion in 'PHP' started by craigedmonds, Mar 10, 2008.

  1. #1
    I am having problems with a simple dumb php statement and keep getting an error:

    Parse error: syntax error, unexpected T_ELSE in /home/assistab/public_html/contact2.php on line 142

    Line 142 is the ELSE statement.

    CAN ANYONE SEE THE SYNTAX ERROR HERE?

    <?php
    //here we need to cehck the post back
    $TheMessage=$_GET["message"];
    if ($TheMessage=="thanks");
    ?>
    blah blah html html
    <?php
    else;
    ?>
    blah blah more html html
    <?php
    endif;
    ?>
     
    craigedmonds, Mar 10, 2008 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    It should be:
    
    if ($TheMessage=="thanks"):
    
    PHP:
    And:
    
    else:
    
    PHP:
    (A colon instead of a semi-colon.)
     
    nico_swd, Mar 10, 2008 IP
    craigedmonds likes this.
  3. craigedmonds

    craigedmonds Notable Member

    Messages:
    706
    Likes Received:
    135
    Best Answers:
    0
    Trophy Points:
    235
    #3
    Ah Great!

    It works now.

    Green Rep for You!!!
     
    craigedmonds, Mar 10, 2008 IP