Php obtains the checkbox check box value. when using php to read the value, checkbox should be in the form of an array. we can read these values in the form of an array.
Php method for obtaining the checkbox check box value
The code is as follows:
Php method for obtaining the checkbox check box value
If ($ _ POST)
{
$ Value = $ _ POST ['checkbox'];
Echo 'you selected:'. implode (',', $ value );
// Because of the checkbox attribute, we must set the name of the checkbox re-selection box to one if checkbox [], so that php can read data in the form of data, otherwise, the value of the checkbox check box cannot be correctly read. // Tidy up jb51.net
}
?>
Checkbox should be in the array format when reading values in php. we can read these values using php post to get them as an array,
The code is as follows:
Php to get the checkbox value of multiple selection boxes
$ Area_arr = array ();
If ($ _ GET ['action'] = "submit "){
$ Area_arr =$ _ POST ['are'];
}
Echo "the region you selected is :";
Foreach ($ area_arr as $ k => $ v ){
Echo $ v ."";
}
?>
Php checkbox default selection problem (this principle is used)
The code is as follows:
>