Home  >  Article  >  Backend Development  >  PHP implements form multi-button submission action processing method, action processing method_PHP tutorial

PHP implements form multi-button submission action processing method, action processing method_PHP tutorial

WBOY
WBOYOriginal
2016-07-12 09:06:48745browse

php implements the processing method of form multi-button submission action. The action processing method

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:

<&#63;php  
 echo "$sub<br>\n";  
 if ("s1"==$sub)  
 {  
  ...  
 }  
 else if ("s2"==$sub)  
 {  
  ...  
 }  
 &#63;>  
 <html>  
 <head><title></title></head>  
 <body>  
 <form action="<&#63;php print("$PHP_SELF"); &#63;>" method="get">  
 <input type="submit" name="sub" value="s1">  
 <input type="submit" name="sub" value="s2">  
 </form>  
 </body>  
 </html>  
 &#63;> 

The above is the method of implementing multi-button submission action in PHP form. I hope it will be helpful to everyone's learning.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1063895.htmlTechArticlephp implements the form multi-button submission action processing method. The action processing method has two submit buttons in the form. To implement When clicking different submit buttons, two different processes are performed...
Statement:
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