How to get a list of unchecked checkboxes when submittimg a form?

Posted by SzamDev on Stack Overflow See other posts from Stack Overflow or by SzamDev
Published on 2010-06-02T16:42:50Z Indexed on 2010/06/02 16:43 UTC
Read the original article Hit count: 278

Filed under:

Hi

I have this code for example :

$b = "";
 while ($row = mysql_fetch_array($rows)) {
        if ($row['enabled'] == 1) {
                    $b = "checked";
              } else {
                     $b = "":
                     }

echo "";

}

When I execute this code, I will get a list of checkboxes, some of them are checked and others are not.

I can use this code to get a list of checked checkboxes.

 if (isset($_POST['sub'])) { //check if form has been submitted or not
$nam = $_POST['nam'];
if (!empty($nam)) {

              foreach($nam as $k=>$val){

    // proccess operation with checked checkboxes
               }

}           

I need to know how I can get list of unckecked checkboxes after submitting the form.

Thanks in advance.

© Stack Overflow or respective owner

Related posts about php