0
如何回顯0,何時不勾選複選框?如何回顯0,何時不勾選複選框?
當按下提交按鈕,它會回顯11 但我想回聲101(回聲0未檢查ckeckbox)。
我該怎麼做?
<form id="form02" name="form02" method="post">
<input name="h_type[]" type="checkbox" id="h_type[]" value="0" checked/><input type="hidden" name="more[]" value="1"> <br/>
<input name="h_type[]" type="checkbox" id="h_type[]" value="1" /><input type="hidden" name="more[]" value="1"> <br/>
<input name="h_type[]" type="checkbox" id="h_type[]" value="2" checked/><input type="hidden" name="more[]" value="1"> <br/>
<input type="submit" name="button" id="button" value="Submit" />
</form>
<?php
$data_h_type=$_POST['h_type'];
$data_more=$_POST['more'];
if(count($data_h_type)>0){
foreach($data_h_type as $key=>$value){
echo $data_more[$value];
echo "<br>";
}
}
?>
不行感謝。 –