How to receive check box information in PHP

xiaoxiao2021-03-06  40

PHP receives multiple same name checkbox information is not as an array as ASP, which has brought certain inconvenience. But there is still a solution, that is, use JavaScript to do preprocessing. A plurality of same name checkboxes in JavaScript or in the form of an array, so before the form is submitted, JavaScript can be used to combine the information in the check box into a hidden element in the form of information, and then use PHP The EXPLODE function parsed this array so that the passage of checkbox information can be implemented. The following is an example.

Suppose there is such a form:

1

2

3

4

This form has four names all of the item check box. When the user clicks on the subs button, the Checker function will be called, and if the Checker returns the True form, it will not be submitted. Here the CHECKER function is the premature function we have to write. Add the following JavaScript in HTML's header section: