Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 07:26 AM
Renie83
Guest
 
Posts: n/a
Default Passing with checkboxes.

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
  #2  
Old July 19th, 2005, 07:26 AM
Ray at
Guest
 
Posts: n/a
Default Re: Passing with checkboxes.

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" <renie83@lycos.com> wrote in message
news:8e153bdf.0308061229.3754c2b3@posting.google.c om...[color=blue]
> 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[/color]


  #3  
Old July 19th, 2005, 07:27 AM
Adrian Forbes - MVP
Guest
 
Posts: n/a
Default Passing with checkboxes.

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
[color=blue]
>-----Original Message-----
>What I have are two pages. One is a form with some input[/color]
boxes and[color=blue]
>check boxes on it. It is posting to a different script[/color]
page that[color=blue]
>inserts into a database and sends the fields through[/color]
email. My problem[color=blue]
>is sending the information which is checked through to[/color]
the next page.[color=blue]
>Each of my checkboxes is given the value of what should[/color]
be inserted in[color=blue]
>the table and into the email. I just need a way of[/color]
determining which[color=blue]
>checkbox is checked so I can send my information.
>Thanks a bunch!
>Renie83
>.
>[/color]
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles