Adding multiple records with checkboxes

Discussion in 'ASP General' started by mellie, Jul 8, 2004.

  1. mellie

    mellie Guest

    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.
     
    mellie, Jul 8, 2004
    #1
    1. Advertising

  2. mellie

    Bullschmidt Guest

    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!
     
    Bullschmidt, Jul 8, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sianan
    Replies:
    5
    Views:
    1,210
    S. Justin Gengo
    Oct 27, 2005
  2. Patrick.O.Ige
    Replies:
    0
    Views:
    678
    Patrick.O.Ige
    Nov 3, 2005
  3. Luke Airig
    Replies:
    0
    Views:
    796
    Luke Airig
    Dec 31, 2003
  4. Dan

    Delete records or update records

    Dan, May 10, 2004, in forum: ASP General
    Replies:
    1
    Views:
    467
    Ray at
    May 10, 2004
  5. Replies:
    3
    Views:
    668
    Anthony Jones
    Nov 2, 2006
Loading...

Share This Page