• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 270
  • Last Modified:

Dynamic checkbox repeat region insert into database table


This is what I want to acheive:

 - The user views a dynamically generated repeat region of options.  These are shown as a tick box and the name of the option.  The user can the options they want and then hits submit to save the options in a MSSQL Server DB.

What I am having trouble with is inserting a dynamic list of options into multiple rows in the DB.  I know I need to create some kind of looping array, but cannot find any information.

Can anyone help? It's an urgent one - my meeting with the client is at 11.00am tomorrow!

1 Solution

Give all your checkboxes the same name, this will automatically pass all of the checked items as a list seperated by commas.

Then just store this list as one column in the db and when you pull the info do a split on the returned string.

Let me know if this is an option, other wise you will have to do something like the following:

For each item in the array:

<input type="checkbox" value="Unique Name 1" name="item1"> Unique Name 1
<input type="checkbox" value="Unique Name 2" name="item2"> Unique Name 2
<input type="checkbox" value="Unique Name 3" name="item3"> Unique Name 3

Then for your SQL:

i1 = Request("item1")
i2 = Request("item2")
i3= Request("item3")

SQL = "INSERT INTO tblRepoAutoSales (column1,column2,column3) VALUES('" & i1 & "','" & i2 & "','" & i3 & "')


Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now