Parse error: syntax error, unexpected T_ELSE(please help)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • khelcrosshatch
    New Member
    • Feb 2012
    • 2

    Parse error: syntax error, unexpected T_ELSE(please help)

    Hi im new in php and i got a problem(T_ELSE) with this code please help!

    "Parse error: syntax error, unexpected T_ELSE in C:\xampp\htdocs \update.php on line 15"

    Code:
    <?php
        include 'db_connect.php';
       
    $name = $_POST['Fname'];
    $surname = $_POST['Sname'];
    $pass = $_POST['Pname'];
    $user = $_POST['Uname'];
    
    if (!$_post['submit']);	
      {
    	echo "echo please fill out the form";
    	header('location: hello.php');
       }
       
       else 
       {
       $sql_insert = "INSERT INTO membersinfo ('name', 'surname', 'pass', 'user') 
    	values ('Fname', 'Sname',  'Pname',  'Uname')};
       echo "user has been created!";
       header('location: hello.php');
       
       ?>
    Last edited by Dormilich; Feb 13 '12, 07:01 AM. Reason: Please use [CODE] [/CODE] tags when posting code.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You didn't close your else statement.

    Comment

    • khelcrosshatch
      New Member
      • Feb 2012
      • 2

      #3
      Thank you Rabbit... now i closed the else statement with "}" but still I got the same "Parse error: syntax error, unexpected T_ELSE".

      <?php
      include 'db_connect.php ';

      $name = $_POST['Fname'];
      $surname = $_POST['Sname'];
      $pass = $_POST['Pname'];
      $user = $_POST['Uname'];


      if (!$_post['submit']);
      {
      echo "echo please fill out the form";
      header('locatio n: hello.php');
      }

      else
      {
      $sql_insert = "INSERT INTO membersinfo ('name', 'surname', 'pass', 'user')
      values ('Fname', 'Sname', 'Pname', 'Uname')";
      echo "user has been created!";
      header('locatio n: hello.php');
      }
      ?>

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        You shouldn't have a semicolon after your if statement.

        Comment

        Working...