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!

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


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 & "')


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.