By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,436 Members | 2,979 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,436 IT Pros & Developers. It's quick & easy.

Adding multiple records with checkboxes

P: n/a
Hi there,

SQL 2000 database with ASP

I've found many things "out there" regarding updating and deleting
multiple records with checkboxes but I can't seem to find anything
about adding them. A user wants to create a price list for their
client and they need to add parts to it in a separate table. I would
like to display the list of parts and the user would select multiple
parts to add to a price list by checking a checkbox and submitting the
form.

I have a form, it dynamically lists all of the parts with a checkbox.

set rs=db.execute("select * from parts")
response.write "<form method=post>"
do while not rs.eof
response.write rs("parts_no") & "<input type=checkbox value=" &
rs("parts_no") & "><br>"
rs.movenext
loop
response.write "<input type=submit>"
response.write "</form>"

The user checks the checkbox, clicks submit and it adds the selected
items as records to another table. If somebody could point me in the
right direction, I'd be most appreciative. Thanks in advance.
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
SQL IN can be useful since HTML checkboxes with the same name produce a
comma-separated list on the page receiving the post:
strSQL = "SELECT * FROM MyTable WHERE MyID IN (" &
Request.Form("MyIDCheckbox") & ")"

But if the field is a text field instead of numeric, then you'll want to
put something like singe quotes around each item perhaps using the
VBScript Split() function to help do this.

SQL IN
http://www.w3schools.com/sql/sql_in.asp

Best regards,
J. Paul Schmidt, Freelance ASP Web Designer
http://www.Bullschmidt.com
ASP Designer Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.