tags:

views:

107

answers:

3

Probably an uber-newbie mistake. Here's my code:

<html>
<body>
    <?php
    if(isset($_POST["firstName"] && isset($_POST["lastName"]))){
    $firstName = $_POST["firstName"];
    $lastName = $_POST["lastName"];     
    echo $firstName;
    }
    else {
    echo "First name was not written in, you suck!";
    }
    ?>
</body> 

I'm getting this error:

Parse error: syntax error, unexpected T_BOOLEAN_AND, expecting ',' or ')' in C:\XAMPP\xampp\htdocs\census.php on line 4

Thanks a bunch!

+1  A: 

As the error message suggests: Missing )

if(isset($_POST["firstName"])

stesch
+1  A: 

Try

<html> <body>
    <?php
    if(isset($_POST["firstName"]) && isset($_POST["lastName"])){
    $firstName = $_POST["firstName"];
    $lastName = $_POST["lastName"];     
    echo $firstName;
    }
    else {
    echo "First name was not written in, you suck!";
    }
    ?> </body>
FinalDestiny
+3  A: 

You're missing a closing parenthesis. It should be:

if(isset($_POST["firstName"]) && isset($_POST["lastName"]))
zdawg
This won't work actually since you have more ')' than '('
anthares
fixed it, though when I clicked on edit, they appeared fine... strangeness...
zdawg
@zdawg - you must have clicked on 'edit' at the exact moment that I submitted the very same edit :)
karim79
Thx, that explains it. :) I was beginning to think that SO is starting to reach levels of consciousness :)
zdawg