SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jul 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Form is not responding

    Dear All,

    I am new to PHP and I was trying out following program which I got online.

    PHP Code:
    <?php
    if(isset($_Post['submit'])){
    if(
    $_Post['username']=="red" and $_Post['password']=="color"){
    echo(
    "you have logged in successfully");
    }
    else{
    echo(
    "error in login");
    }
    }
    ?>

    <html>
    <head></head>
    <body>
    <form method="post" action="login.php">
    <lable>Username:</lable><input type="text" name="username"/>
    <lable>Password:</lable><input type="text" name="password"/>
    <input type="submit" name="submit" value="login">
    </form>
    </body>
    </html>
    But when i submit the form, it doesn't 'echo' instead the form appears again.

    What am i doing wrong here. I tried out many other programs with 'form' and results were same.

    I am using PHP version 5.4.16. Output was same even when i was using PHP 5.3 version

    Please let me know.


    I am first time visitor of PHP sitepoint. Seems to be a great resource for learners.


    Thank You,
    Norma.
    Last edited by ParkinT; Jul 23, 2013 at 04:49. Reason: Added 'code' tags for better formatting of code snippet

  2. #2
    Avid Logophile silver trophy
    ParkinT's Avatar
    Join Date
    May 2006
    Location
    Central Florida
    Posts
    2,343
    Mentioned
    192 Post(s)
    Tagged
    4 Thread(s)
    Firstly, welcome to Sitepoint. Congratulations on learning more about PHP and this is the place to get answers to your questions.
    There are a few things about your snippet that I see immediately.

    In ALL software development spelling is important.

    The `$_POST` variable should be all capital letters.
    And, less important, 'label' is misspelled in your HTML.

    Try those few changes and report your success or ask for more help.

    Good luck.

    By the way, please be sure to use the [code] tag when pasting in snippets of code.
    Last edited by ParkinT; Jul 23, 2013 at 06:35.
    Don't be yourself. Be someone a little nicer. -Mignon McLaughlin, journalist and author (1913-1983)


    Git is for EVERYONE
    Literally, the best app for readers.
    Make Your P@ssw0rd Secure
    Leveraging SubDomains

  3. #3
    SitePoint Member
    Join Date
    Jul 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @Parkin T ; thank you for your quick reply. Will try out that.

  4. #4
    SitePoint Member
    Join Date
    Jul 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Parkin thanks a lot.. thank u so much.

    I changed $_Post to $_POST and i got the result. I was stuck in this for a week.

    Thank You.


Bookmarks

Posting Permissions

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