Page 5 of 5 FirstFirst 12345
Results 41 to 47 of 47
  1. #41
    Join Date
    Jun 2006
    Posts
    4,832
    Tokens
    0

    Latest Awards:

    Default

    Hmm, the code seems fine to me :s

    PHP Code:
    <?php
    $name 
    $_POST ['name'];
    $age $_POST ['age'];
    $location $_POST ['location'];
    if (
    $name == null){
    echo 
    "Enter a name!";
    } else {
    echo 
    "Hmm, so your name is ".$name."";
    if (
    $age == null){
    echo 
    "Enter a name!";
    } else {
    echo 
    "you are ".$age." years old";
    if (
    $location == null){
    echo 
    "Enter a location!";
    } else {
    echo 
    " and you live in ".$location."... interesting!";
    }
    ?>
    It just doesn't work
    Last edited by Hitman; 07-09-2006 at 03:42 PM.

  2. #42
    Join Date
    Aug 2006
    Location
    Northamptonshire
    Posts
    250
    Tokens
    0

    Default

    PHP Code:
    <?php
    $name 
    $_POST ['name'];
    $age $_POST ['age'];
    $location $_POST ['location'];
    if (
    $name == null){
    echo 
    "Enter a name!";
    } else {
    echo 
    "Hmm, so your name is ".$name."";
    if (
    $age == null){
    echo 
    "Enter a name!";
    } else {
    echo 
    "you are ".$age." years old";
    if (
    $location == null){
    echo 
    "Enter a location!";
    } else {
    echo 
    " and you live in ".$location."... interesting!";
    }
    }
    ?>

  3. #43
    Join Date
    Jun 2006
    Posts
    4,832
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by PixelResources View Post
    PHP Code:
    <?php
    $name 
    $_POST ['name'];
    $age $_POST ['age'];
    $location $_POST ['location'];
    if (
    $name == null){
    echo 
    "Enter a name!";
    } else {
    echo 
    "Hmm, so your name is ".$name."";
    if (
    $age == null){
    echo 
    "Enter a name!";
    } else {
    echo 
    "you are ".$age." years old";
    if (
    $location == null){
    echo 
    "Enter a location!";
    } else {
    echo 
    " and you live in ".$location."... interesting!";
    }
    }
    ?>
    Parse error: syntax error, unexpected $end in /home/thebobb/public_html/team-x/test/form.php on line 19

    Nope. :s

  4. #44
    Join Date
    Aug 2006
    Location
    Northamptonshire
    Posts
    250
    Tokens
    0

    Default

    PHP Code:
    <?php
    $name 
    $_POST ['name'];
    $age $_POST ['age'];
    $location $_POST ['location'];
    if (
    $age == null && $location == null){
    echo 
    "You left a field blank!";
    } else {
    echo 
    "you are ".$age." years old and you live in ".$location."... interesting!";
    }
    ?>
    edit: also why are you defining the name variable but you dont use it?

    you went the way complicated way round things >.>
    Last edited by PixelResources; 07-09-2006 at 03:51 PM.

  5. #45
    Join Date
    Jun 2006
    Posts
    4,832
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by PixelResources View Post
    PHP Code:
    <?php
    $name 
    $_POST ['name'];
    $age $_POST ['age'];
    $location $_POST ['location'];
    if (
    $age == null && $location == null){
    echo 
    "You left a field blank!";
    } else {
    echo 
    "you are ".$age." years old and you live in ".$location."... interesting!";
    }
    ?>
    edit: also why are you defining the name variable but you dont use it?

    you went the way complicated way round things >.>
    I am using $name :s


    PHP Code:
    if ($name == null){
    echo 
    "Enter a name!";
    } else {
    echo 
    "Hmm, so your name is ".$name.""
    >.>

  6. #46
    Join Date
    Aug 2006
    Location
    Northamptonshire
    Posts
    250
    Tokens
    0

    Default

    Ah yes :]

    PHP Code:
    <?php
    $name 
    $_POST ['name'];
    $age $_POST ['age'];
    $location $_POST ['location'];
    if (
    $age == null && $location == null && $name == null){
    echo 
    "You left a field blank!";
    } else {
    echo 
    "Hmm so your name is ".$name." you say?<br>You are ".$age." years old and you live in ".$location."... interesting!";
    }
    ?>

  7. #47
    Join Date
    Jun 2006
    Posts
    4,832
    Tokens
    0

    Latest Awards:

    Default

    LOL I just fixed it too :p

    PHP Code:
    <?php
    $name 
    $_POST ['name'];
    $age $_POST ['age'];
    $location $_POST ['location'];
    if (
    $name == null && $age == null && $location == null){
    echo 
    "You missed something!";
    } else {
    echo 
    "Hmm, so your name is ".$name.", you are ".$age." years old and you live in ".$location."... Cool!";
    }
    ?>


    http://team-x-labs.net/test/form.html btw

    Edit: I also added bold tags.
    Last edited by Hitman; 07-09-2006 at 04:00 PM.

Page 5 of 5 FirstFirst 12345

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •