By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,921 Members | 1,493 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,921 IT Pros & Developers. It's quick & easy.

Passing with checkboxes.

P: n/a
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
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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" <re*****@lycos.com> wrote in message
news:8e**************************@posting.google.c om...
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

Jul 19 '05 #2

P: n/a
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 andcheck boxes on it. It is posting to a different script page thatinserts into a database and sends the fields through email. My problemis sending the information which is checked through to the next page.Each of my checkboxes is given the value of what should be inserted inthe table and into the email. I just need a way of determining whichcheckbox is checked so I can send my information.
Thanks a bunch!
Renie83
.

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.