There are two submit buttons in the form. To realize that when different submit buttons are clicked, two A different processing process, here is a processing method to implement the form multi-button submission action to share with everyone.
Use PHP to judge, one form has two buttons, the name attribute of the button is set to the same, but the value is set to different. After the form is submitted, you only need to judge the submitted value to go to a different processing process. This method It is more reasonable and suitable for multiple buttons in one form.
PHP method, the code is as follows:
<?php echo "$sub<br>\n"; if ("s1"==$sub) { ... } else if ("s2"==$sub) { ... } ?> <html> <head><title></title></head> <body> <form action="<?php print("$PHP_SELF"); ?>" method="get"> <input type="submit" name="sub" value="s1"> <input type="submit" name="sub" value="s2"> </form> </body> </html> ?>
The above is the method of implementing multi-button submission action in PHP form. I hope it will be helpful to everyone's learning.