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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -