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

  • Home
  • SEARCH
  • 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 7583877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:47:17+00:00 2026-05-30T18:47:17+00:00

I want to have multiple checkbox values be stored into one field in a

  • 0

I want to have multiple checkbox values be stored into one field in a database. (Ex. 1, 24,56,100). I am wanting to know how I can make this happen, and how does PHP read these values from the database if I want to call variables in a query?

Basically I am creating a blog app (for fun and experience) and I want the user to be able to change the visibility of each blog post through checkboxes. I know you are probably thinking why don’t I just have a visibility field for each blog post. I understand why it is not recommended to do this, but I can’t think of any other way to do this. To explain a bit more: I want to attach this application to a CMS I have already built, and basically I have a table with blog posts, and then I want the user to be able to go to different pages within their site and add a blog. Well, what if the user wants to use the same blog on 3 different pages, but only wants certain posts to show on each page. So this is why I am confused right now.

  • 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-30T18:47:18+00:00Added an answer on May 30, 2026 at 6:47 pm

    Even though I am not in favor of saving data like that but here is what you can do, if you really want to do it that way. I suggest you have a denormalized table and store your vals there

    in your HTML you can have your checkboxes like this (considering you are storing ids of some sort)

    <input type="checkbox" name="ids[]" value"1" />
    <input type="checkbox" name="ids[]" value"24" />
    <input type="checkbox" name="ids[]" value"56" />
    <input type="checkbox" name="ids[]" value"100" />
    

    On you php side you can use function implode to form ids into a string as shown below (considering you are doing a POST)

    $ids = implode(",",$_POST["ids"]);
    

    Where you read from the database you can transform the value from db to an array like this

    $ids_array = explode(",",$row->ids);
    

    I hope this helps

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

Sidebar

Related Questions

I have a user control that contains multiple controls (CheckBox, Button, Label...). I want
I want to have a tree in memory, where each node can have multiple
I have a checkbox select all issue. I have multiple checkbox that can be
I know how to validate a single checkbox, but what if I have multiple
I want to have multiple multiple choices given to user after the form submit
We have multiple vb projects.We want to put error handlers in all functions, and
I have multiple SharePoint lists and want to display data from them on to
I have multiple excel files which I open as datatable I want to merge
I have multiple document.ready functions on a page and I want a function to
I have multiple buttons on a page and I want to simulate a click

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.