Results 1 to 3 of 3

Thread: Mulitple Checkbox with same name

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2002
    Location
    Hampton Beach
    Posts
    513

    Mulitple Checkbox with same name

    I have a html page with 4 checkbox with the same name... When I submit my form how do I get the value of each item in the array using request.form??

    I tried response.write "Test" & request.form("chkbox[0]") but no luck..

  2. #2
    New Member
    Join Date
    Jul 2005
    Posts
    4

    Re: Mulitple Checkbox with same name

    Is request.form("chkbox")(0)?

  3. #3
    Frenzied Member DeadEyes's Avatar
    Join Date
    Jul 2002
    Posts
    1,196

    Re: Mulitple Checkbox with same name

    Give the checkboxes a value
    Code:
    <input type="checkbox" name="checks" value="1"><br/>
    <input type="checkbox" name="checks" value="2"><br/>
    <input type="checkbox" name="checks" value="3"><br/>
    <input type="checkbox" name="checks" value="4"><br/>
    Then in the Asp use the Request.Form("checks")
    this will return a string indicating which values are checked. Only the checkboxes that are selected will get POSTed.
    For example if I check the odd numbered ones Request.Form will return
    "1,3"
    If I check them all it will return
    "1,2,3,4"

Posting Permissions

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



Click Here to Expand Forum to Full Width