Skip to main content
August 8, 2006
Question

Multiple Inserts based on check box?

  • August 8, 2006
  • 1 reply
  • 366 views
I have an insert form that depending on if checkboxes are checked, inserts the data. How can I insert a record for the number of check boxes checked?

Example:
CB 1 = Checked
CB 2 = Not Checked
CB 3 = Checked

So I need to insert a record for CB 1 and CB 3. How can I do this?

What I'm doing is tying a sales lead to the sales man selected. I'm using check boxes because I figured it was easiest but I'm open to suggestions.
This topic has been closed for replies.

1 reply

August 8, 2006
In your example, CB 1 and CB 3 are checked. But your explanation states you need to insert a record for CB 1 and CB 2. What am I missing?

Keep in mind that you will not see the variable FORM.CB2, since unchecked checkboxes to not pass their name to the action page. Maybe the code below will help. By naming all the check boxes the same, you receive a comma-delimited list of the values of only the checked checkboxes. You can then put this in a list loop and update your database.
August 8, 2006
Yes, CB1 and CB3 - I fixed that in the original post ... thank you.

Awesome, I'll take a look and see if I can get this working! :p