Jump to content


Photo

Parse Error: Syntax Error, Unexpected $end


  • Please log in to reply
1 reply to this topic

#1 nevx

nevx
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 28 June 2006 - 07:54 AM

can anyone help me out i keep gettin this error when i run this sricpt
Parse error: syntax error, unexpected $end in C:\wamp\www\php\testhandle_form.php on line 50
i have the html page set up already

this is th php page
<?php
$name=$_POST['name'];
$comments=$_POST['comments'];
$email=$_POST['email'];
$gender=$_POST['gender'];

 if (Strlen($name)>0) {
     $name=stripslashes($name);
 }else { 
    $name=NULL;
    echo '<p><b>You forgot to enter your name!</b></p>';
}

 if (Strlen($comments)>0) {
     $comments=stripslashes($comments);
 }else { 
    $comments=NULL;
    echo '<p><b>You forgot to enter your comments!</b></p>';
}

//check email
if (!(strlen($email)>0)) {
    $email=NULL;
    echo'<p><b>You forgot to enter your email!</b></p>';
}
 // gender
if (isset($gender)){
    if($gender =='M') {
    $message='<b><p>Good Day , Sir!</p></b>';
    }elseif ($gender=='F') {
        $message='<b><p>Good Day , Madam!</p></B>';
    }
    else {
        $gender=NULL;
        echo'<p><b>You Forgot to enter your gender!</b></P>';
    } 


//if everything was filled out
if ($name && $comments && $email && $gender)
    {
    echo ('Thank you , <b> $name </b> for the following commnets:<br><tt> $comments </tt><br>');
    echo $message;
    }
?>


any help appreciated thanks

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 28 June 2006 - 02:44 PM

You have forgot to add a closing } after this:
elseif ($gender=='F') {
        $message='<b><p>Good Day , Madam!</p></B>';
    }
    else {
        $gender=NULL;
        echo'<p><b>You Forgot to enter your gender!</b></P>';
    }
} // this was missing





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users