Home > Backend Development > PHP Tutorial > PHP multiple submit submission form example code

PHP multiple submit submission form example code

怪我咯
Release: 2023-03-13 21:50:01
Original
4255 people have browsed it

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[ &#39;test &#39;]; 
echo &#39;12 &#39;; 
echo $test; 
echo $_POST[ &#39;submit1 &#39;]; 
echo $_POST[ &#39;submit2 &#39;]; 
if (isset($_POST[ &#39;submit1 &#39;]) && $_POST[ &#39;submit1 &#39;] == &#39;submit1 &#39;) 
{ 
echo &#39;ok1 &#39;; 

} 
if (isset($_POST[ &#39;submit2 &#39;]) && $_POST[ &#39;submit2 &#39;] == &#39;submit2 &#39;) 
{ 
// echo " <meta http-equiv=refresh content= &#39;0; url=http://localhost:8000/php/index.php &#39;> "; 
// header( "Location:index.php "); 
// break; 
echo &#39;ok2 &#39;; 
} 
?>
Copy after login

The code is as follows:

<html> 
<head> </head> 
<body> 
<form action= &#39;xajaxtest.php &#39; method= &#39;POST &#39;> 
<input type= &#39;hidden &#39; name= &#39;test &#39; value= &#39;test1 &#39;> 
<input name= &#39;submit1 &#39; type= &#39;submit &#39; value= &#39;submit1 &#39; title= &#39;submit1 &#39;> 
<input name= &#39;submit2 &#39; type= &#39;submit &#39; value= &#39;submit2 &#39; title= &#39;submit2 &#39;> 
</form> 
</body> 
</html>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template