Passing with checkboxes.

Discussion in 'ASP General' started by Renie83, Aug 6, 2003.

  1. Renie83

    Renie83 Guest

    What I have are two pages. One is a form with some input boxes and
    check boxes on it. It is posting to a different script page that
    inserts into a database and sends the fields through email. My problem
    is sending the information which is checked through to the next page.
    Each of my checkboxes is given the value of what should be inserted in
    the table and into the email. I just need a way of determining which
    checkbox is checked so I can send my information.
    Thanks a bunch!
    Renie83
    Renie83, Aug 6, 2003
    #1
    1. Advertising

  2. Renie83

    Ray at Guest

    If the checkbox is not checked, it will not return a value:

    <form method="post" action="someotherpage.asp">
    <input type="checkbox" name="checkbox1" value="This is checkbox number one."
    checked>
    <input type="checkbox" name="checkbox2" value="This is the second
    checkbox.">
    <input type="submit">
    </form>

    post to:

    Response.Write Request.Form("checkbox1") & "<hr>"
    Response.Write Request.Form("checkbox2")


    There will be no value for checkbox2, because it was not checked.

    You could also use some logic like:
    bCheckbox2WasChecked = Len(Request.Form("checkbox2")) > 0
    Response.write bCheckbox2WasChecked

    Ray at work

    "Renie83" <> wrote in message
    news:...
    > What I have are two pages. One is a form with some input boxes and
    > check boxes on it. It is posting to a different script page that
    > inserts into a database and sends the fields through email. My problem
    > is sending the information which is checked through to the next page.
    > Each of my checkboxes is given the value of what should be inserted in
    > the table and into the email. I just need a way of determining which
    > checkbox is checked so I can send my information.
    > Thanks a bunch!
    > Renie83
    Ray at, Aug 6, 2003
    #2
    1. Advertising

  3. Easiest way is to give your check boxes all the same name,
    lets say chkData, and when you go

    Request("chkData")

    the returned values will be the VALUEs of the checked
    boxes all comma delimited;

    "red,blue,green"

    etc

    You can make an array from this and parse the items like

    aData = Split(Request("chkData"), ",")
    for i = lbound(aData) to ubound(aData)
    response.write aData(i) & "<br>"
    next

    >-----Original Message-----
    >What I have are two pages. One is a form with some input

    boxes and
    >check boxes on it. It is posting to a different script

    page that
    >inserts into a database and sends the fields through

    email. My problem
    >is sending the information which is checked through to

    the next page.
    >Each of my checkboxes is given the value of what should

    be inserted in
    >the table and into the email. I just need a way of

    determining which
    >checkbox is checked so I can send my information.
    >Thanks a bunch!
    >Renie83
    >.
    >
    Adrian Forbes - MVP, Aug 7, 2003
    #3
    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. Fresh Air Rider

    Checkboxes with Repeaters and DataGrids

    Fresh Air Rider, Mar 5, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    483
    Fresh Air Rider
    Mar 5, 2004
  2. Victor Bazarov
    Replies:
    25
    Views:
    854
    E. Robert Tisdale
    Mar 23, 2005
  3. pereges
    Replies:
    7
    Views:
    426
    pereges
    Jun 1, 2008
  4. Ramon F Herrera
    Replies:
    8
    Views:
    473
    Pascal J. Bourguignon
    Sep 13, 2009
  5. deadpickle
    Replies:
    1
    Views:
    960
    Jens Thoms Toerring
    Nov 7, 2010
Loading...

Share This Page