CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2005
    Posts
    2

    Unhappy PHP Basics - Frustrated

    Hi all. OK, Perl novice trying to learn PHP. I'm on XPSP2, Apache2 and PHP 5.0.4. Just installed everything, and trying this simple little form to test if PHP is working right...

    <html>
    <head><title>PHP says Hello</title></head>
    <body>

    <form method "POST" action="sayhello.php">
    Your Name: <input type="text" name="user">
    <input type="submit" value="Say">
    </form>

    </body>
    </html>

    sayhello.php is as follows...

    <?php

    print "Hello, ";
    print $_POST['user'];
    print "!";

    ?>

    And finally, the result is... Hello, !

    I have checked the Apache config, online sites and googled the error message in the Apache error log that says...

    [client 127.0.0.1] PHP Notice: Undefined index: user in D:\\Apache2\\htdocs\\sayhello.php on line 4, referer: http://localhost/test.html

    This is the first step and it is not working! At my wits end...HELP!

    NOTE: I tried running a simple script that checks if PHP is installed right with your Apache server... <?phpinfo() ?> ...and it works fine!!!

    Thanks,
    Sonya

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: PHP Basics - Frustrated

    Code:
    <form method "POST" action="sayhello.php">
    Your Name: <input type="text" name="user">
    <input type="submit" value="Say">
    </form>
    You are missing one minor thing. The "=" sign between "method" and "POST".

    Code:
    <form method="post" action="sayhello.php">
    Your Name: <input type="text" name="user">
    <input type="submit" value="Say">
    </form>
    Last edited by peejavery; April 15th, 2005 at 11:58 AM.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Jun 2004
    Location
    Philippines
    Posts
    31

    Re: PHP Basics - Frustrated

    Nice answer
    I am inviting you to join GreenZap. It is just like PAYPAL but it is more rewarding! You get $25 when you join (FREE to sign up) AND you get rewarded also when someone opened an account using your GreenZap promo code! GreenZap is launching June 1st.

    Click here and PREREGISTER

    Have a break. Visit JonelsPlace

  4. #4
    Join Date
    Apr 2005
    Posts
    2

    Smile Re: PHP Basics - Frustrated

    I cannot believe it was such a stupid thing! Thanks for taking the time and correcting me!!

    Grateful,
    Sonya

  5. #5
    Join Date
    May 2002
    Posts
    10,943

    Re: PHP Basics - Frustrated

    Sometimes we miss the little things.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured