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

How to read in 150 checkbox values and output to email body?

P: 7
I have a form with 150 checkboxes. Need to send email with the Checked ones usng ASP. But i am unable to figure a simple way to do it. All i can understand is getting their values one by one and creating variables for all of them in the asp file and then put each in the body of the email body.

Please help me with a Simple Solution! If you show me with a Code then it will he highly appreciated.

Thanks in advance..

Aslam
Dec 2 '10 #1

✓ answered by jhardman

You don't need an array, you need a loop like the one I showed in my first response.
Expand|Select|Wrap|Line Numbers
  1. for each x in request.form
  2.    VarBody = varBody & x.name & ": " & x.value & "<br>" & vbnewline
  3. Next
it loops through each item submitted in your form, and adds each to a new line in your mail body.

Jared

Share this Question
Share on Google+
9 Replies


jhardman
Expert 2.5K+
P: 3,405
Expand|Select|Wrap|Line Numbers
  1. For each x in request.form
  2.    'Perform some code here for each checkbox such as
  3.    Response.write x.name & ": " & x.value & "<br>" & vbnewline
  4. Next
does this suggest a solution to your problem?

Jared
Dec 2 '10 #2

P: 7
please make it more simpler.. any short way to handle 170 checkboxes..
Dec 3 '10 #3

jhardman
Expert 2.5K+
P: 3,405
This is unquestionably the simplest way to do it. Show me the code you use to put one or two checkboxes in an email, and I will show you how to adapt this loop for your code.

Jared
Dec 3 '10 #4

P: 7
Dim checkbox

checkbox=request.form("checkbox")

varBody = checkbox. bla bla bla

so its a very long process to do it one by one .. so i need the array methods.. that i can learn and use on it and on future work..

thanks
Dec 3 '10 #5

jhardman
Expert 2.5K+
P: 3,405
You don't need an array, you need a loop like the one I showed in my first response.
Expand|Select|Wrap|Line Numbers
  1. for each x in request.form
  2.    VarBody = varBody & x.name & ": " & x.value & "<br>" & vbnewline
  3. Next
it loops through each item submitted in your form, and adds each to a new line in your mail body.

Jared
Dec 3 '10 #6

P: 7
so i just have to declare all of them first and then use this loop in the body right!! let me try and get back

so i should name x ( that you used ) as checkbox
Dec 3 '10 #7

jhardman
Expert 2.5K+
P: 3,405
You don't have to declare anything, the script already has access to the request object. Just loop through it.

Jared
Dec 3 '10 #8

P: 7
ok thanks i will get back with the results
Dec 3 '10 #9

P: 7
this is what i am trying to do . .but no results.. error about the saying the Objec Required name
Expand|Select|Wrap|Line Numbers
  1. for each checkbox in request.form 
  2. varbody = "aslam" & varbody & checkbox.name & ": " & checkbox.value & "<br>" & vbnewline
  3. Next 
Dec 5 '10 #10

Post your reply

Sign in to post your reply or Sign up for a free account.