How to validate checkbox group in PHP -
hi im struggling problem, can 1 help? got series of check boxes dynamically populated. line looks below part of while loop.
echo "<td class='brc'><input type='checkbox' name='delz[]' value='$wec' ></td>";
when validating i'm finding difficult see at-least once check box check in loop. got following work, identifies vise versa need. how change give me output when nothing checked message echo saying 'nothing checked'?
$selectboxes = $_post['delz']; foreach($selectboxes $a) {if($selectboxes == ""){echo "some check boxes selected !!!"; return;}}
deselected checkboxes not passed through html forms.
therefore:
$checkboxesselected = isset($_post['delz']); if ($checkboxesselected) { echo "some check boxes selected"; } else { echo "no check boxes selected."; }
should work.
Comments
Post a Comment