按ENTER键提交表单

时间:2015-03-16 11:00:04

标签: forms submit

我有一个提交表单,当我点击“登录”按钮时,$_POST['login']包含一些内容,但是当我按下ENTER键时它是空的。

形式

<form class="form-vertical login-form" action="conexio.php" method="post">
        <h3 class="form-title">Login to your account</h3>
        <div class="alert alert-error hide">
            <button class="close" data-dismiss="alert"></button>
            <span>Enter any username and password.</span>
        </div>
        <div class="control-group">
            <!--ie8, ie9 does not support html5 placeholder, so we just show field title for that-->
            <label class="control-label visible-ie8 visible-ie9">Username</label>
            <div class="controls">
                <div class="input-icon left">
                    <i class="icon-user"></i>
                    <input class="m-wrap placeholder-no-fix" type="text" autocomplete="off" placeholder="Username" name="username"/>
                </div>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label visible-ie8 visible-ie9">Password</label>
            <div class="controls">
                <div class="input-icon left">
                    <i class="icon-lock"></i>
                    <input class="m-wrap placeholder-no-fix" type="password" autocomplete="off" placeholder="Password" name="password"/>
                </div>
            </div>
        </div>
        <div class="form-actions">
            <button type="submit" class="btn blue pull-right" name="login">
            Login <i class="m-icon-swapright m-icon-white"></i>
            </button>
        </div>
    </form>

1 个答案:

答案 0 :(得分:1)

尝试将<button>替换为<input type='submit'>