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 7989661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:48:59+00:00 2026-06-04T12:48:59+00:00

Is it possible to populate a checkboxlist from the database values? If so, please

  • 0

Is it possible to populate a checkboxlist from the database values? If so, please suggest how to do this.

$query2 = "select * from Products where CategoryID = '$CategoryName' ";
 mysql_query($query2) or die(mysql_error());
 $array = array();

while($row = mysql_fetch_assoc($query2)){
$array[] = $row;}

foreach($array as $val)
 {
 if($val =='the checkbox value')
  • 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-06-04T12:49:00+00:00Added an answer on June 4, 2026 at 12:49 pm
    <form>
    <input type="checkbox" name="vehicle" value="Bike" /> I have a bike<br />
    <input type="checkbox" name="vehicle" value="Car" /> I have a car
    </form>
    

    These are the few steps you have to do.
    1.Fetch the values from database.
    2. Covert the values in array as they are stored as string by (,) separated.
    3. Then

    foreach($values as $val)
         {
              if($val =='Bike')
                 {
                       $bikeflag = '1';
                 }
                if($val =='Car')
                 {
                       $carflag = '1';
                 }
    
        }
    <form>
    <input type="checkbox" name="vehicle" value="Bike"  <?php if(isset($bikeflag ) =='1'){ ?>checked = checked <?php } ?>/> I have a bike<br />
    <input type="checkbox" name="vehicle" value="Car"   <?php if(isset($carflag) =='1'){ ?>checked = checked <?php } ?>/> I have a car
    </form>
    

    Hopefully this will help you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Populate unique values in to VBA array from excel I need to
I want to populate Response.ContentType = text/plain; From somewhere in the server/web/dictionary ALL possible
Possible Duplicate: SQL left join vs multiple tables on FROM line? SELECT messages.message_title, messages.message_content,
Question: I want to populate a LINQ table from code, not DataBase. Is it
I use this code for populate the combobox but It is possible associate at
is it possible to populate a listview based on a row Id from a
If you populate a drop down list of possible values, you only want the
Is it possible to populate a listview with a dataset? I have a function
I have discovered that it is possible to populate resource strings with variable information
Possible Duplicates: Why is lock(this) {...} bad? In C# it is common to use

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.