Simple CheckBox Question

M

MarkVan

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
 
J

Jason Brown [MSFT]

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>
 
H

Hal Rosser

MarkVan said:
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)
 
B

Bullschmidt

<<
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...
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top