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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Aslam Shah
    New Member
    • Dec 2010
    • 7

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

    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
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    Code:
    For each x in request.form
       'Perform some code here for each checkbox such as
       Response.write x.name & ": " & x.value & "<br>" & vbnewline
    Next
    does this suggest a solution to your problem?

    Jared

    Comment

    • Aslam Shah
      New Member
      • Dec 2010
      • 7

      #3
      please make it more simpler.. any short way to handle 170 checkboxes..

      Comment

      • jhardman
        Recognized Expert Specialist
        • Jan 2007
        • 3405

        #4
        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

        Comment

        • Aslam Shah
          New Member
          • Dec 2010
          • 7

          #5
          Dim checkbox

          checkbox=reques t.form("checkbo x")

          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

          Comment

          • jhardman
            Recognized Expert Specialist
            • Jan 2007
            • 3405

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

            Jared

            Comment

            • Aslam Shah
              New Member
              • Dec 2010
              • 7

              #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

              Comment

              • jhardman
                Recognized Expert Specialist
                • Jan 2007
                • 3405

                #8
                You don't have to declare anything, the script already has access to the request object. Just loop through it.

                Jared

                Comment

                • Aslam Shah
                  New Member
                  • Dec 2010
                  • 7

                  #9
                  ok thanks i will get back with the results

                  Comment

                  • Aslam Shah
                    New Member
                    • Dec 2010
                    • 7

                    #10
                    this is what i am trying to do . .but no results.. error about the saying the Objec Required name
                    Code:
                    for each checkbox in request.form 
                    varbody = "aslam" & varbody & checkbox.name & ": " & checkbox.value & "<br>" & vbnewline
                    Next

                    Comment

                    Working...