Home > Article > Backend Development > PHP multiple submit submission form example code
When the entered username and password are empty, judgment is required. At this time, verification of username and password is used. This needs to be written on the front-end page of jsp; there are two methods, one is to submit using submit. One is to submit using button.
This article mainly tells you how to handle multiple submit forms in PHP (distinguishing different form submissions)
test.php
<?php $test = $_POST[ 'test ']; echo '12 '; echo $test; echo $_POST[ 'submit1 ']; echo $_POST[ 'submit2 ']; if (isset($_POST[ 'submit1 ']) && $_POST[ 'submit1 '] == 'submit1 ') { echo 'ok1 '; } if (isset($_POST[ 'submit2 ']) && $_POST[ 'submit2 '] == 'submit2 ') { // echo " <meta http-equiv=refresh content= '0; url=http://localhost:8000/php/index.php '> "; // header( "Location:index.php "); // break; echo 'ok2 '; } ?>
The code is as follows:
<html> <head> </head> <body> <form action= 'xajaxtest.php ' method= 'POST '> <input type= 'hidden ' name= 'test ' value= 'test1 '> <input name= 'submit1 ' type= 'submit ' value= 'submit1 ' title= 'submit1 '> <input name= 'submit2 ' type= 'submit ' value= 'submit2 ' title= 'submit2 '> </form> </body> </html>
The above is the detailed content of PHP multiple submit submission form example code. For more information, please follow other related articles on the PHP Chinese website!