普通网友 2015-09-10 15:32
浏览 20
已采纳

PHP在文本框中提交名称

I have just started learning php. However I am having trouble with the code below. I know it automatically prints out You're not a member... But when I then enter "letmein" it still says I am not a member. Any guidance would be much appreciated

    <html>
    <head>
    <title>A BASIC HTML FORM</title>

    <?PHP

    $username = $_POST['username'];

    if ($username == "letmein") {

    print ("Welcome back, friend!");

    }
    else {

    print ("You're not a member of this site,goodbye");

    }

    ?>


    </head>
    <body>
    <FORM NAME ="form1" METHOD ="POST " ACTION = "basicForm.php">


    <INPUT TYPE = "TEXT" VALUE ="username" Name="username">
    <INPUT TYPE = "Submit" Name = "Submit1" VALUE = "Login">

    </FORM>
    </body>
    </html>
  • 写回答

1条回答 默认 最新

  • doulupian8725 2015-09-10 15:38
    关注

    You have an extra space in the METHOD ="POST " of your form.

    Change it to METHOD="POST".

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?