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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:48:37+00:00 2026-05-26T17:48:37+00:00

I currently have a dropdown box which enters an integer into a table. It’s

  • 0

I currently have a dropdown box which enters an integer into a table. It’s adding $myVariable choice to a list in the database based on the ID singularly.

What i’m struggling to do is convert this dropdown selection system to a checkbox system where the user checks which $myVariable’s and inserts them into a database.

How can I insert multiple ID’s [myVariableID] into a database in one insert statement?

Edit:
I have a table with a list of X. The X has an ID, so I want to insert that ID into another table.

X 1 has ID 1

X 2 has ID 2

Inserting these values into a table allows me to see what X have been associated using a linking table.

Therefore, with a list of checkboxes (Outputs all of X that has been added), I need to insert the ID of X multiple times into the linking table.

It is currently limited because the dropdown selects X, and X ID. If I use checkboxes, how do I dynamically grab the ID of X, and insert whatever X‘s are selected, and add X ID multiple based on the checkbox selections.

Example

Name      ID
X1    ||  1
X2    ||  2
X3    ||  3
X4    ||  4

User selects X1, X2, insert ID 1, 2 into a database table. I can’t have $var1, $var2, .. etc because the list might be added to. This is why I thought of an array or foreach

Problem:
A dropdown selection has one value ($variable)
A checkbox system (What I want) has multiple possible values.

  • 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-26T17:48:38+00:00Added an answer on May 26, 2026 at 5:48 pm

    INSERT supports inserting multiple values.

    Quick example:

    INSERT INTO table (id, something) VALUES (1, 10), (2, 11), (1, 28)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a dropdown box which contains a list of all of the
So I have a drop-down list and a text-box: <table> <tr> <td>Group Name: </td>
I have a page with a dropdown list defined as follows $memb=$this->api->db->dsql()->table('vscrum_member m') ->field('m.id')
Currently I have a web application where a user can use dropdown lists to
I currently have an MS Access application that connects to a PostgreSQL database via
I currently have an existing database and I am using the LINQtoSQL generator tool
I currently have a functioning in-house Windows Forms application which extensively uses the DataGridView
The OnSelectedIndexChanged event is not firing for my dropdown box. All forums I have
I have a dropdown box that I construct with PHP. Here is the code:
I currently have a search box in our admin navigation that is submitting to

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.