Results 1 to 2 of 2

Thread: retrieve values of checkbox

  1. #1
    Join Date
    Sep 2003

    retrieve values of checkbox

    i'm trying to retrieve the values of my checkbox
    see demo below - it's not working
    what am i doing wrong

    response.write "Number of Products" & numproducts
    if i<>"" then
    for num = 1 to numproducts
    if request.form("productid"& num)<>"" then
    response.write "productid" & num & " is checked.
    end if
    end if


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    <form method=post>
    test 1 <input type="checkbox" name="productid1" value"1">

    test 2
    <input type="checkbox" name="productid2" value"3851">

    test 3
    <input type="checkbox" name="productid3" value"3899">

    test 4
    <input type="checkbox" name="productid4" value"45345">

    test 5
    <input type="checkbox" name="productid5" value"3834">
    <input type=hidden name=numproducts value=6>

    <input type=submit name=submit value="test">

  2. #2
    Join Date
    Feb 2007
    Why don't you just name each check box "productid[]" and let ASP grab the array productid[] submitted by the form. Much simpler

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center