zoukankan      html  css  js  c++  java
  • 多个submit

    <html>
    <body>

    <form action="welcome.php" method="post">
    Name: <input type="text" name="name"><br>
    E-mail: <input type="text" name="email"><br>
    <input type="submit" name="s1">
    <input type="submit" name="s2">
    </form>

    </body>
    </html>

    <html>
    <body>

    <?php
    if (isset($_POST["s1"])) {
    echo "s1";
    }
    if (isset($_POST["s2"])) {
    echo "s2";
    }
    ?>

    </body>
    </html>

    点击s1时出现s1,点击s2时出现s2,通过此可以判断触发表单的是submit,可以传name到后台。

  • 相关阅读:
    Day26
    Day25
    day24
    day22
    DAY21
    Day20
    Day19
    Day18
    Day17
    RabbitMQ
  • 原文地址:https://www.cnblogs.com/liuwenbohhh/p/4415003.html
Copyright © 2011-2022 走看看