When you recently made form submission, the check box checkbox submitted data does not know how to handle, checkbox allows multiple options, we can not each option to customize the Name property, and then the background one by one to obtain, which is not convenient to expand.
Later, after looking up some data, I found that the key point is the checkbox's Name property. You need to give the checkbox a uniform array of name, such as mycheckbox[], which is a way to define the array in PHP. The data is then retrieved in the background, such as the $_post[' MyCheckBox ' of the POST form, at which point the data is already an array. The following is a simple example.
Form form Code
<input name= "hobby[]" type= "checkbox" value= "HTML"/>html
<input name= "hobby[]" type= "checkbox" value= "CSS"/>css
PHP form Processing
Var_dump ($_post);
if (Isset ($_post["hobby"])) {
foreach ($_post["hobby"] as $hobby) {
echo "language: {$hobby}<br/>";
}
}
In fact, any set of text boxes of the same data can be used in this way to get values in batches, not just checkboxes.