help with T_IF error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • drgnhiker
    New Member
    • Jan 2010
    • 5

    #1

    help with T_IF error

    I have checked this stuff six ways from Sunday and can not find an error....can anyone help? My error message is this:
    Parse error: syntax error, unexpected T_IF in C:\Program Files (x86)\Apache Software Foundation\Apac he2.2\htdocs\mo viesite.php on line 14


    Code:
    <?php
    session_start();
    
    //check to see if user has logged in with a valid password
    if ($_SESSION['authuser'] != 1) {
        echo 'Sorry, but you don\'t have permission to view this page!';
        exit();
    }
    ?>
    <html>
     <head>
      <title>
     <?php>
     if (isset($_GET['favmovie'])) {
        echo ' - ';
        echo $_GET['favmovie'];
     }
    ?>
      </title>
     </head>
    <body>
    <?php include 'header.php'; ?>
    <?php
      function listmovies_1() {
        echo '1. Sound of Music<br/>';
        echo '2. Wizard of Oz<br/>';
        echo '3. Lord of the Rings Trilogy<br/>';
        echo '4. Ten Commandments<br/>';
        echo '5. Star Wars<br/>';
    Last edited by Dormilich; Jan 30 '10, 09:27 AM. Reason: please use [code] tags when posting code
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    Your second opening tag for php is <?php> instead of <?php

    BTW: use code tags, please.




    Dan

    Comment

    • dlite922
      Recognized Expert Top Contributor
      • Dec 2007
      • 1586

      #3
      and I hope you have more to your file than what you pasted, because your listmovies_() function is not closed with a closing curly braces.





      Dan

      Comment

      • drgnhiker
        New Member
        • Jan 2010
        • 5

        #4
        OMG!!! what a little thing....I have taught myself to make sure everything is inside <> and then I added one too many when not needed......cod e works perfect now. Yes there is more to it and it closes itself. Thanks for the feedback. And I am going to watch much more closely. Thanks again

        Comment

        • drgnhiker
          New Member
          • Jan 2010
          • 5

          #5
          thought about that after I posted...thanks

          Comment

          • dlite922
            Recognized Expert Top Contributor
            • Dec 2007
            • 1586

            #6
            If you get a PHP editor it usually flags it for you. I know what your error meant when I first saw it, but I'm lazy I did not go through it character by character to see where you missed it. I pasted it into my IDE (NuSphere PHPED), and it underlined the problem in red immediately.

            Not all PHP editors have syntax checkers like this, but it really helps you time and frustration wise in the long run if you get one that does.



            Dan

            Comment

            Working...