how PHP gets checkbox values for checkboxes
Copy Code code as follows:
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title>php method to get CheckBox value </title>
<body>
<form name= "Form1" method= "Post" action= "" >
<label>
<input type= "checkbox" Name= "checkbox[]" value= "Check One" >
Check A
</label>
<label>
<input type= "checkbox" Name= "checkbox[]" value= "Check Two" >
</label>
Check Two
<label>
<input type= "checkbox" Name= "checkbox[]" value= "Check three" >
</label>
Check Three
<label>
<input type= "checkbox" Name= "checkbox[]" value= "Check Four" >
</label>
Check Four
<label>
<input type= "Submit" name= "Submission" value= "submitted" >
</label>
</form>
</body>
?
if ($_post)
{
$value = $_post[' checkbox '];
Echo ' You chose: '. Implode (', ', $value);
Because of the checkbox properties, we must set the checkbox's name to one if checkbox[] so that PHP can read it in data form, otherwise it cannot correctly read the CheckBox checkbox value OH. Jb51.net finishing of cloud-dwelling community
}
?>
checkbox in PHP to read the value in the array form Oh, we read these values in PHP post fetch is in an array form Oh,
Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title>php Get checkbox value for multiple marquee </title>
<body>
<?php
$area _arr = Array ();
if ($_get[' action ']== "submit") {
$area _arr = $_post[' area '];
}
echo "Your chosen area is:";
foreach ($area _arr as $k => $v) {
echo $v. " ";
}
?>
<form id= "Form1" Name= "Form1" method= "Post" action= "Action=submit" >
<p> Hebei
<label>
<input type= "checkbox" id= "area" name= "area[" "value=" "Hebei" >
</label>
</p>
<p> Henan
<label>
<input type= "checkbox" id= "area[]" name= "area[" "value=" Henan ">
</label>
</p>
<p> Shanxi
<label>
<input type= "checkbox" id= "area[]" name= "area[" "value=" Shanxi ">
</label>
</p>
<p> Shandong
<label>
<input type= "checkbox" id= "area[]" name= "area[" "value=" Shandong ">
</label>
</p>
<p> Jiangsu
<label>
<input type= "checkbox" id= "area[]" name= "area[" "value=" Jiangsu ">
</label>
</p>
<p> Zhejiang
<label>
<input type= "checkbox" id= "area[]" name= "area[" "value=" Zhejiang ">
</label>
</p>
<p>
<label>
<input type= "Submit" name= "Submission" value= "submitted" >
</label>
</p>
</form>
</body>
The php checkbox defaults to the problem (which is the principle used)
Copy Code code as follows:
<input name= "jb51" type= "checkbox" value= "Jiaju" <?php if ($myrow [Fujia_jiaju]) echo ("checked");? >>