tags:

views:

41

answers:

1

Please tell me what needs to be done, to avoid the message:

Parse error: syntax error, unexpected $end in /xxxx/xxxxxxx/public_html/contact-    it/feedback.php on line xxx (the last line of feedback.php = ?>)

Thanks to all for any hint.

if(empty($data_start)) { 
    if(empty($data_end)) { 
        if(empty($comment)) { 
        # all empty 
echo "You have not specified any details to submit to us";
    exit ;

?>
A: 

You are missing closing curly braces:

if(empty($data_start)) { 
    if(empty($data_end)) { 
        if(empty($comment)) { 
        # all empty 
echo "You have not specified any details to submit to us";
    exit();
}}}

You should re-factor your code like this:

if(empty($data_start) && empty($data_end) && empty($comment)){
    exit("You have not specified any details to submit to us");
}

More Info:

Sarfraz
BINGO !!!Taht was fast and YES - it works fine ! THANKS a lot.
Frank
@Frank: Welcome...
Sarfraz
Frank
Sarfraz - can I bother you once more ? I promise won't come backafter that - except with a "thanks". Have extended the code a bit: When 'data_start' and 'data_end is given, but no 'pax', there should be a message:
Frank
}if(empty($data_start) } # arrival, departure and comments empty if(!isset($data_start) } # arrival, departure given, but pax empty
Frank
resolves in Parse error: syntax error, unexpected T_IF in /xxxx/xxxxx/contact-it/feedback.php on line 71
Frank
@Frank: You should edit your main question again with anything you want to add :)
Sarfraz
OK: I have 3 fields:arrival, departure and no of persons (pax)When arrival (date_start) is entered and departure (date_end) is entered, there should be an entry in the field "pax" as well. If not, there should be a message: "please tell us the number..."
Frank
exit statements don't need brackets http://uk3.php.net/manual/en/function.exit.php
Nev Stokes