Home >Backend Development >PHP Tutorial >PHP handle Checkbox checkbox form submission

PHP handle Checkbox checkbox form submission

WBOY
WBOYOriginal
2016-07-25 08:45:311920browse

Add [] after the name of the check box on the PHP form submission page, so that the correct result can be obtained on the receiving page. After the form is submitted, you get an array, and then you get the specific vaule value of the form by accessing the array elements. The value of checkbox1 obtained has line break by default.

Form code:

  1.   Check box 1:
  2.  Checkbox 2:
  3.  Checkbox 3:
  4.  
  5.  
Copy code

PHP form processing code:
  1.   if(isset($_POST["Download"]))
  2.   {
  3.   foreach($_REQUEST['checkbox1'] as $checkbox1)
  4.    {
  5.   echo $checkbox1 ;
  6.    }
  7.   }
  8. ?>
Copy code

Checkbox, PHP, Checkbox


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