post变量中未定义的索引

时间:2016-04-29 18:54:40

标签: php mysql

我正在尝试编写代码而我收到的错误是我的帖子不是"定义"这里有一些我的代码:

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel = "stylesheet">

                                                            忘记密码?             

        <div style="padding-top:30px" class="panel-body" >

            <div style="display:none" id="login-alert" class="alert alert-danger col-sm-12"></div>

            <form id="loginform" method = "post" action = "login.php" class="form-horizontal" role="form">

                <div style="margin-bottom: 25px" class="input-group">

                    <input id="register-username" type="text" class="form-control" name="username" value="" placeholder="username or email">
                </div>

                <div style="margin-bottom: 25px" class="input-group">

                    <input id="register-password" type="password" class="form-control" name="password" placeholder="password">
                </div>
                <div style="margin-bottom: 25px" class="input-group">

                    <input id="register-confirm-password" type="password" class="form-control" name="password-confirm" placeholder="password">
                </div>



                <div class="input-group">
                    <div class="checkbox">
                        <label>
                            <input id="login-remember" type="checkbox" name="remember" value="1"> Remember me
                        </label>
                    </div>
                </div>


                <div style="margin-top:10px" class="form-group">
                    <!-- Button -->

                    <div class="col-sm-12 controls">
                        <input type="submit" class="btn btn-info" value="Login">


                        <a id="btn-fblogin" href="#" class="btn btn-primary">Login with Facebook</a>

                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

也是我的PHP代码,它说我上线7,8,9未定义索引这很奇怪,因为帖子似乎是正确的。 这是以下几行我可以在

中得到错误
$username =htmlspecialchars($_POST["username"]);
$password =htmlspecialchars($_POST["password"]);
$confirm_password= htmlspecialchars($_POST["password-confirm"]);

0 个答案:

没有答案