Home  >  Article  >  Backend Development  >  Use PHP to process multiple checkboxes with the same name_PHP tutorial

Use PHP to process multiple checkboxes with the same name_PHP tutorial

WBOY
WBOYOriginal
2016-07-15 13:23:04692browse

If there are multiple checkboxes with the same name in a form, there will only be one value when submitted to php, not a series of values ​​separated by commas like asp. There is a very simple way to solve it: add [] after the name of the check box, for example: changed to: . In this way, php will get an array called ccc. But there is a problem with this method. If you want to use JavaScript to judge whether the check box is selected and how many are selected on the client, JavaScript will make an error because the name of the check box contains []. You can add a hidden field to the form and set its value using JavaScript.



...

...



www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446884.htmlTechArticleIf there are multiple checkboxes with the same name in a form, there will be only one value when submitted to php, and none of them will It is not a series of values ​​separated by commas like asp. There is a very simple way to solve it: place...
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