Results 1 to 3 of 3

Thread: PHP Problem

  1. #1
    Join Date
    Sep 2006
    Posts
    2

    Default PHP Problem

    Hi...
    I just began studying PHP and immediately ran into problems. I can't get my site to respond properly to the code presented below. I'm trying to get the code to generate different page for different names when correcting the URL (example http://mysite.com/test.php?name=Jack). (If the name is Jack, I want it to display "Hello Jack".) Instead of displaying hello Jack when I correct the URL, it displays the else value
    Code:
    PHP Code:
    <?php
    if($name==Jack)
    echo 
    "Hello, Jack";
    else
    echo 
    "You're not Jack";
    ?>
    Thank you in advance.

  2. #2
    Join Date
    Feb 2006
    Location
    Somewhere where I don't know where I am
    Posts
    2,155

    Default

    use this

    PHP Code:
    <?php
    if ($_GET['name'] == 'Jack') {
         echo 
    "Hello, Jack";
    }
              else {
                   echo 
    "You're not Jack";
              }
    ?>
    Sign Up Now!
    Unlimited Storage, Unlimited Transfer, Host Unlimited domain names, 1 Free Domain Name
    BlueHost Features | BlueHost Help Desk | Become a BlueHost Affiliate | BlueHost CEO Blog
    (888) 401-4678 | Create a support ticket

  3. #3
    Join Date
    Sep 2006
    Posts
    2

    Default

    Thank you, mate, you rule! Respect

Posting Permissions

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