Jump to content

Parse Error: Syntax Error, Unexpected $end


nevx

Recommended Posts

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
[code]<?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;
    }
?>[/code]


any help appreciated thanks
Link to comment
Share on other sites

You have forgot to add a closing } after this:
[code]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[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.