多个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到后台。

原文地址:https://www.cnblogs.com/liuwenbohhh/p/4415003.html