简体   繁体   中英

Two HTML Submit buttons for one FORM

I have the following form in my HTML. The form is used to submit the data to a PHP file, which would then send notifications to android Phones. 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. I prefer to use two different PHPs for andorid and iOS. How can I place two buttons for the same form? The below is my HTML form.

<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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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