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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:51:58+00:00 2026-05-31T22:51:58+00:00

Multiple categories selection system for Article Earlier M using two tables articles & categories

  • 0

Multiple categories selection system for Article

Earlier M using two tables
articles & categories and save category ID in articles table
But in this system I can save only one category ID per article
I want to save Article in Multiple categories

While searching I found same question on StackOverflow

I understand the whole concept of adding one more table of relationship & saving Article ID & Category ID in this table.
But not aware how to implement multiple selection system using arrays in New Article Form & Edit Article Form.

earlier I am showing Select in my form to display categories list in Add Article & Edit Article Page.

pls someone explain me How to show categories list in multiple checkbox style in my form so user can select multiple categories and then after POST how to get checkbox data and run query to insert data in both Article Table & New Relationship table with selected categories ID

want to display category List like this screenshot

Many Many Thanks…

EDIT:
I use echo '<input type="checkbox" name="selcats[]" value="$catid"> ' .$catname;
to display Categories check box
Its showing in a row side by side.
how to change display like screenshot i.e. list with scrollbar
& need to process this array and insert in new table while inserting article in databse.

EDIT 2
got the checkbox display correct in a scroll list by using a div 😀
<div style="height: 150px; width: 200px; overflow: auto;">

  • 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-31T22:51:59+00:00Added an answer on May 31, 2026 at 10:51 pm

    In my case, I use a “tag system”, for instance: You have an article with one category, nothing will change that… In adition, you can create another field in the article table with the relevant words (or whatever you want) and separete them with spaces or commas.

    // Get the data from your database
    $tags = 'world, travel, turism, cities';
    
    // Separate the values
    $tags = explode(", ", $tags);
    
    // Create a link for each one
    foreach($tags as $t)
    {
        echo ' <a href="?tag=' . $t . '">' . ucfirst($t) . '</a> ' . "\r\n"; 
    }
    

    It should output:

     <a href="?tag=world">World</a> 
     <a href="?tag=travel">Travel</a> 
     <a href="?tag=turism">Turism</a> 
     <a href="?tag=cities">Cities</a>
    

    And it means that you can SELECT articles that have the title LIKE the tag, or whatever you want to search.

    Is that what you was looking for?

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

Sidebar

Related Questions

I have two tables, products and category. A product can be in multiple categories.
I have two classes : Expenditure and Category. An Expenditure can have multiple Categories.
I have two tables, categories and movies . In movies table I have a
I have the following in mind: A product can have multiple categories A category
How to retrieve the last updated data from multiple categories using php and mysql.
I have multiple lists on one page (multiple categories of products) like this: <h3>Category
I have a database table with categories for different products in it. Each category
I currently have a database with two tables called Articles and Tags . In
I have two tables in my rails application Categories and Projects. The relationship between
Ok, so, I have a lot of articles classified in multiple categories across my

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.