【问题标题】:button inside form should not submit form表单内的按钮不应提交表单
【发布时间】:2016-03-19 11:35:49
【问题描述】:

在我的表单标签中,我有两个名为 SIGNIN 和 SIGNUP 的按钮,如果按下 SIGNIN 按钮,则应提交表单。如果按下 SIGNUP 按钮,它应该重定向到下面锚标记中给出的 url,但它总是提交表单。请帮帮我。

<form action="controllers/user/vauth.php" method="post" role="form" class="userLogin" style="padding:20px;">
    <div class='alert alert-danger' id='errorLabel' style="display:none;"></div>
        <?php
        if(isset($_SESSION['error'])) {
        echo "<div class='alert alert-danger' id='errorLabel'>";
        foreach($_SESSION['error'] as $error) echo "<p><b>".$error."</b></p>";
        echo "</div>";
        unset($_SESSION['error']);
        }
        if(isset($_SESSION['message'])) {
        echo "<div class='alert alert-success'>".$_SESSION['message']."</div>";
        unset($_SESSION['message']);
        }
        ?>
        <div class="form-group">
        <label for="email">Email</label>
        <input type="text" name="vemail" id="vemail" class="form-control" placeholder="Enter Email" value="<?php if(isset($_SESSION['values'])) echo $_SESSION['values']['email']; ?>">
        </div>
        <div class="form-group">
        <label for="password">Password</label>
        <input type="password" name="vpassword" id="vpassword" class="form-control" placeholder="Enter Password">
        </div>
        <div class="form-group">
        <a href="user/vfpass.php">Forgot Password ?</a>
    </div>
    <button type="submit" class="btn btn-default" name="vsubmit">LOG IN</button><a href="../signup"><button class="btn btn-success" name="signup" style="float:right;">SIGN UP</button></a>
</form>

【问题讨论】:

标签: html forms


【解决方案1】:

type="button" 添加到您的注册按钮

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-03-23
    • 1970-01-01
    • 2017-08-18
    • 1970-01-01
    • 2013-01-09
    • 2015-11-19
    • 2013-04-10
    • 2019-03-21
    相关资源
    最近更新 更多