Jump to content

Archived

This topic is now archived and is closed to further replies.

nevx

Parse Error: Syntax Error, Unexpected $end

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

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites

×

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.