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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:01:26+00:00 2026-05-27T20:01:26+00:00

I have checkboxes with name statuses. This is how i am doing it: $_SESSION[‘statuses’]

  • 0

I have checkboxes with name statuses. This is how i am doing it:

   $_SESSION['statuses'] = mysql_real_escape_string($_POST['statuses']);

When i insert it that is how i am doing it:

   $insert = "INSERT INTO submitted (statuses) 
   VALUES ('".$_SESSION['statuses']."')";

   $query = mysql_query($insert) or die ("Error: ".mysql_error());

Problem is nothing that is checked gets inserted into the database, so how do i insert checked entries?

NEW/UPDATE:

This is how the checkbox form looks like:

                    <input type="checkbox" name="statuses" value="something">
        <input type="checkbox" name="statuses" value="something">
        <input type="checkbox" name="statuses" value="something">
        <input type="checkbox" name="statuses" value="something">
        <input type="checkbox" name="statuses" value="something">
        <input type="checkbox" name="statuses" value="something">
  • 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-27T20:01:27+00:00Added an answer on May 27, 2026 at 8:01 pm

    Perhaps the issue might lie in the mark up you have written for the form. Here’s and example:

    <form action="checkbox-form.php" method="post">
    Select your options<br />
    <input type="checkbox" name="options[]" value="A" />A<br />
    <input type="checkbox" name="options[]" value="B" />B<br />
    <input type="checkbox" name="options[]" value="C" />C<br />
    <input type="submit" name="formSubmit" value="Submit" />
    </form>
    

    Notice that options is set as options[]. This allows an array of all checked options to appear in your POST super variable.

    If you do:

    var_dump($_POST['options']);
    

    You should then get an array containing all the checked values.

    Then you can do something like:

    foreach($_POST['options'] as &$option){
       mysql_real_escape_string($option);
    }
    

    Then insert into the database:

       $insert = "INSERT INTO submitted (statuses)       
       VALUES ('". implode(",", $_POST['options']) ."')";      
    
       $query = mysql_query($insert) or die ("Error: ".mysql_error());
    

    Update:
    On each page of the form you should have something like escape the values and save it to the session. This then saves the values from each page to the user’s session:

    //Page 1
    foreach($_POST['options'] as $option){
         $_SESSION['options'][] = mysql_real_escape_string($option);
    }
    
    //page 2
    $_SESSION['SOME_OTHER_VALUE_FROM_TEXT_BOX'] = mysql_real_escape_string($_POST['SOME_OTHER_VALUE_FROM_TEXT_BOX');
    
    //Final page:
    //Everything is now stored in SESSION, so you can use them there:
    //For example, display the value of options:
    var_dump($_SESSION['options']); //etc
    
    //So here, you would just run your sql queries to insert the appropriate data into your databse.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a group of checkboxes that all have the same name. They all
I have checkboxes (all with the same 'name' attribute) that I want sent to
I have this piece of code I've done so far: $assign = $_POST['assign']; if(!empty($name)
I have this form with multiple checkboxes with same name and all of checkboxes
I have this case <WrapPanel> <CheckBox>Really long name</CheckBox> <CheckBox>Short</CheckBox> <CheckBox>Longer again</CheckBox> <CheckBox>Foo</CheckBox> <Slider MinWidth=200
He, I have this page where i have checkboxes next to every item in
I have 10 checkboxes that are scattered throughout a page and if any one
I have set of images and checkboxes like below <form name=food_type_form method=post action=proc.php> <img
I have a pretty large form that consists of radio buttons/checkboxes as well as
i have jquery code that loop through all checkboxes. $('input[type=checkbox]').each(function () { I now

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.