Adding multiple records with checkboxes

M

mellie

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.
 
B

Bullschmidt

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top