表单数据未通过Button Click提交到PHP文件

时间:2019-02-20 08:57:42

标签: php html

我正在使用以下代码在php中进行简单登录。我已将操作设置为test.php,但是单击登录按钮时什么也没有发生。     

    <div class="limiter">
        <div class="container-login100" style="background-image: url('images/bg-01.jpg');">
            <div class="wrap-login100">
                <form class="login100-form validate-form" action="test.php">
                    <span class="login100-form-logo">
                        <i class="zmdi zmdi-landscape"></i>
                    </span>

                    <span class="login100-form-title p-b-34 p-t-27">
                        Log in
                    </span>

                    <div class="wrap-input100 validate-input" data-validate = "Enter username">
                        <input class="input100" type="text" name="username" placeholder="Username">
                        <span class="focus-input100" data-placeholder="&#xf207;"></span>
                    </div>

                    <div class="wrap-input100 validate-input" data-validate="Enter password">
                        <input class="input100" type="password" name="pass" placeholder="Password">
                        <span class="focus-input100" data-placeholder="&#xf191;"></span>
                    </div>

                    <div class="contact100-form-checkbox">
                        <input class="input-checkbox100" id="ckb1" type="checkbox" name="remember-me">
                        <label class="label-checkbox100" for="ckb1">
                            Remember me
                        </label>
                    </div>

                    <div class="container-login100-form-btn">
                        <button class="login100-form-btn">
                            Login
                        </button>
                    </div>

                    <div class="text-center p-t-90">
                        <a class="txt1" href="#">
                            Forgot Password?
                        </a>
                    </div>
                </form>
            </div>
        </div>
    </div>

1 个答案:

答案 0 :(得分:1)

更改

<button class="login100-form-btn">Login</button>

收件人

<button class="login100-form-btn" type="submit">Login</button>

还要在表单中添加方法属性。

<form class="login100-form validate-form" action="test.php">

外观

<form class="login100-form validate-form" action="test.php" method="POST">

然后在您的test.php端使用$_POST