Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 823133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:54:16+00:00 2026-05-15T02:54:16+00:00

I have this code for example : $b = ; while ($row = mysql_fetch_array($rows))

  • 0

I have this code for example :

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

echo “<\input name=’nam[$row[id]]’ type=’checkbox’ value=’$row[id]’ $b />”;

}

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T02:54:17+00:00Added an answer on May 15, 2026 at 2:54 am

    If the check boxes are dynamically created this is a trivial task:

    Create a naming convention. For example, lets say that each checkbox is tied to a row in the DB, each row in the DB has a primary key. You can name each checkbox based off this key:

    <input type="checkbox" id="foo_1" name="foo_1" />
    <input type="checkbox" id="foo_2" name="foo_2" />
    <input type="checkbox" id="foo_3" name="foo_3" />
    

    Now when the form is submitted you can query the database to get the Id’s and process the request as follows:

    
    $res = mysql_query("select * from foo;");
    while($row = mysql_fetch_array($res))
        $checked = isset($_POST["foo_{$row['id']}");
        ...
    }
    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code (an example that PHP generates for me)... <select id=outsideBlue3> <option
For example, I have this code: <table> <tr> <td class=last></td> <td></td> </tr> <tr> <td
If I have a simple cucumber feature and scenario , like this (example code
For example we have this line chart at Google Code API there is a
Suppose we have this example: http://techdroid.kbeanie.com/2009/07/custom-listview-for-android.html with source code available here: http://code.google.com/p/myandroidwidgets/source/browse/trunk/Phonebook/src/com/abeanie/ How can
For Example if i have my code like this (php): <?php somefunc(1); function somefunc($a)
Ok, in my code I have for example, this: $('.follow').click(function(){ var myself = $(this);
I have this code that is an example I found. In this code, I
I have this table : I would like to delete same rows. For example
I have a jQuery function to dynamically add rows containing input fields, this exists

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.