Simple CheckBox Question

Discussion in 'ASP General' started by MarkVan, Mar 11, 2005.

  1. MarkVan

    MarkVan Guest

    I am pretty new to ASP.

    HTML Page
    <input type="checkbox" name="chkStat" value="" checked>Low

    ASP Page
    chkCheck = request.form("chkStat")
    response.write chkCheck

    I get nothing? How do I pass the value of the checkbox from the HTML page
    to ASP page.

    Thank you
    MarkVan, Mar 11, 2005
    #1
    1. Advertising

  2. you haven't given it a value. well, you have. an empty string.

    if you actually give it a value, it'll pass that.

    <input type="checkbox" name="chkStat" value="This Is A Value" checked>


    --
    Jason Brown
    Microsoft GTSC, IIS

    This posting is provided "AS IS" with no warranties, and confers no rights.


    "MarkVan" <> wrote in message
    news:...
    >I am pretty new to ASP.
    >
    > HTML Page
    > <input type="checkbox" name="chkStat" value="" checked>Low
    >
    > ASP Page
    > chkCheck = request.form("chkStat")
    > response.write chkCheck
    >
    > I get nothing? How do I pass the value of the checkbox from the HTML page
    > to ASP page.
    >
    > Thank you
    >
    >
    >
    >
    >
    Jason Brown [MSFT], Mar 11, 2005
    #2
    1. Advertising

  3. MarkVan

    Hal Rosser Guest

    "MarkVan" <> wrote in message
    news:...
    > I am pretty new to ASP.
    >
    > HTML Page
    > <input type="checkbox" name="chkStat" value="" checked>Low
    >
    > ASP Page
    > chkCheck = request.form("chkStat")
    > response.write chkCheck
    >
    > I get nothing? How do I pass the value of the checkbox from the HTML page
    > to ASP page.
    >


    Actually you're getting an empty string, which is the "value" you assigned
    to the "chkStat" checkbox.
    make this change:
    <input type="checkbox" name="chkStat" value="Low" checked>Low
    _____________________________________^ (new value)
    Hal Rosser, Mar 12, 2005
    #3
  4. MarkVan

    Bullschmidt Guest

    <<
    I get nothing? How do I pass the value of the checkbox from the HTML
    page to ASP page.
    >>


    Generally speaking you can pass variables from page to page by:

    1) Posting form fields from one page to the next (or to the same page)
    and on the page to retrieve the value strLName = Request.Form("LName")

    2) Using a querystring such as Response.Redirect
    "login.asp?lname=smith&fname=tom" and on the page to retrieve the values
    strLName = Request.QueryString("lname") and strFName =
    Request.QueryString("fname")

    3) Using session variables such as Session("LName") = "Smith" and on the
    page to retrieve the value strLName = Session("LName")

    4) Using cookie variables such as Cookie("LName") = "Smith" and on the
    page to retrieve the value strLName = Cookie("LName")

    Best regards,
    J. Paul Schmidt, Freelance ASP Web Developer
    http://www.Bullschmidt.com
    ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Bullschmidt, Mar 15, 2005
    #4
    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. tshad
    Replies:
    0
    Views:
    505
    tshad
    Apr 15, 2005
  2. Vikram

    disable checkbox list checkbox

    Vikram, Jan 25, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    1,378
    ThunderMusic
    Jan 25, 2006
  3. =?Utf-8?B?RG90TmV0RGV2?=

    DataGrid and embeded Checkbox..How to find if checkbox clicked

    =?Utf-8?B?RG90TmV0RGV2?=, Oct 6, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    802
    David Wier
    Oct 6, 2006
  4. Jason Huang
    Replies:
    0
    Views:
    538
    Jason Huang
    Jun 29, 2007
  5. Joey Pang
    Replies:
    4
    Views:
    505
    Joey Pang
    Jun 13, 2005
Loading...

Share This Page