Dynamic checkbox repeat region insert into database table

Posted on 2006-04-17
Last Modified: 2006-11-18

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!

Question by:nixianick
    1 Comment
    LVL 6

    Accepted 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

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
    I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now