简体   繁体   English

一个表单的两个HTML提交按钮

[英]Two HTML Submit buttons for one FORM

I have the following form in my HTML. 我的HTML中有以下表格。 The form is used to submit the data to a PHP file, which would then send notifications to android Phones. 该表单用于将数据提交到PHP文件,该文件随后将向Android Phone发送通知。 Now I would need an addition. 现在,我需要添加一个。 I need to submit the same data to another PHP file, which would submit the data to another PHP page, which would send the notifications to Apple devices. 我需要将相同的数据提交到另一个PHP文件,该文件将数据提交到另一个PHP页面,该页面会将通知发送到Apple设备。 I prefer to use two different PHPs for andorid and iOS. 我更喜欢将两个不同的PHP用于Andorid和iOS。 How can I place two buttons for the same form? 如何为同一表格放置两个按钮? The below is my HTML form. 以下是我的HTML表单。

<form action="notifdatabaseonlyios.php" method="post">
                <label class="lb">Title</label>
                <input type="text" name="title" class="form-control" />
                <label class="lb">Description</label>
                <textarea class="msg" name="desc"></textarea>
                <br>
                <input type="hidden" name="type" value='notification'>
                <button class="btn btn-info pull-right">Submit</button>
                </div>

                </form>

one method: 一种方法:
Give 2 buttons in the form with different button names, If user clicks the first button go to notifdatabaseonlyios.php 在表单中给2个按钮使用不同的按钮名称,如果用户单击第一个按钮,请转到notifdatabaseonlyios.php

if ($_POST['button1'])      
{  }      
else if($_POST['button2'])      
{  }  
?>  

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM