我将购物车集成到我的网站上,现在我尝试仅使用一张由客户填写的表格(个人信息),但我遇到了一个问题,因为我想根据不同的情况使用两个不同的提交按钮客户选择的支付平台。有人知道一个简单的解决方案吗?我提前表示感谢。
最佳答案
您必须在按钮标签中传递具有不同名称属性值的名称属性,如下所示 -
<button type="submit" name="button1">Button 1</button>
<button type="submit" name="button2">Button 2</button>
在 PHP 代码中 --
<?php
if(isset($_POST['button1]))
{
// here we will add code of button 1
}
if(isset($_POST['button2]))
{
// here we will add code of button 2
}
?>
请尝试这个......
关于javascript - HTML 表单拆分为两个不同的提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32236821/