4 Replies Latest reply on Jul 24, 2008 5:53 PM by Newsgroup_User

    ASP help!

    Sutton808303
      Hi evryone,

      I am having a nightmare getting my radio buttons to return results. It is just a simple contact form with name, email and 'i will' & 'will not' be attending. Ive looked everywhere for help on this and im either putting it in the wrong place or just doing it wrong. Any help would be very much appreciated. Thanks in advance. Code below:-

      contact.html:-

      <div class="text_col_left">
      <h1>Champagne Canapés Reception RSVP</h1>
      <p><img src="images/component_images/line_break_480.gif" alt="" width="470" height="1" /></p>
      <h2><strong>PAGE INTRO TEXT</strong><br />
      <br />
      </h2>
      <h2>Please R.S.V.P. by 14th August 2008 by using the form below or by phone: <br />
      •••••••••••</h2>
      <p><img src="images/component_images/line_break_480.gif" alt="" width="470" height="1" /> </p><form method="POST" action=" http://www.MYSITE.COM/contact.asp">
      <h2><strong>Please complete the following:<br />
      </strong></h2>
      <p><img src="images/component_images/line_break_480.gif" alt="" width="470" height="1" /></p>
      <p>Full Name:<br />
      <input name="Name" type="text" size="45" />
      </p>
      <p>Email:<br />
      <input name="Email" type="text" size="45" />
      </p>
      <p><img src="images/component_images/line_break_480.gif" alt="" width="470" height="1" /><br />
      </p>
      <p>
      <label>
      <input name="attend" type="radio" id="attend_0" value="radio" checked="checked" />
      I will be attending</label>
      <br />
      <label>
      <input type="radio" name="attend" value="attend" id="attend_1" />
      I will NOT be attending</label>
      <br />
      </p>
      <p><img src="images/component_images/line_break_480.gif" alt="" width="470" height="1" /><br />
      </p>
      <p>
      <input type="submit" name="submit" value="Submit" />
      </p>
      </form>
      </div>


      ASP FORM:-

      <%

      ' declare variables
      Dim EmailFrom
      Dim EmailTo
      Dim Subject
      Dim Name
      Dim Email

      ' get posted data into variables
      EmailFrom = "me@mysite.com"
      EmailTo = "me@mysite.com"
      Subject = "Derby RSVP"
      Name = Trim(Request.Form("Name"))
      Email = Trim(Request.Form("Email"))


      ' prepare email body text
      Dim Body
      Body = Body & "Name: " & Name & VbCrLf
      Body = Body & "Email: " & Email & VbCrLf


      ' send email
      Dim mail
      Set mail = Server.CreateObject("CDONTS.NewMail")
      mail.To = EmailTo
      mail.From = EmailFrom
      mail.Subject = Subject
      mail.Body = Body
      mail.Send

      ' redirect to success page
      Response.Redirect("thanks.html")
      %>
        • 1. Re: ASP help!
          Level 7
          > I am having a nightmare getting my radio buttons to return results. It is
          > just
          > a simple contact form with name, email and 'i will' & 'will not' be
          > attending.
          > Ive looked everywhere for help on this and im either putting it in the
          > wrong
          > place or just doing it wrong. Any help would be very much appreciated.
          > Thanks
          > in advance. Code below:-


          > ASP FORM:-
          >
          > <%
          >
          > ' declare variables
          > Dim EmailFrom
          > Dim EmailTo
          > Dim Subject
          > Dim Name
          > Dim Email
          >
          > ' get posted data into variables
          > EmailFrom = "me@mysite.com"
          > EmailTo = "me@mysite.com"
          > Subject = "Derby RSVP"
          > Name = Trim(Request.Form("Name"))
          > Email = Trim(Request.Form("Email"))
          >
          >
          > ' prepare email body text
          > Dim Body
          > Body = Body & "Name: " & Name & VbCrLf
          > Body = Body & "Email: " & Email & VbCrLf
          >
          >
          > ' send email
          > Dim mail
          > Set mail = Server.CreateObject("CDONTS.NewMail")
          > mail.To = EmailTo
          > mail.From = EmailFrom
          > mail.Subject = Subject
          > mail.Body = Body
          > mail.Send
          >
          > ' redirect to success page
          > Response.Redirect("thanks.html")
          > %>



          What is the error message? The component you are using (cdonts) is
          deprecated, and it is likely that your host does not have it installed on
          the server. Ask your host what email components they support.



          • 2. Re: ASP help!
            Sutton808303 Level 1
            Hi Ted,

            Thanks for the quick reply. My host is cool with the cdonts and the form comes through fine. Just not with any info from the radio buttons.

            I should of mentioned that the ASP code above has any reference to the radio buttons removed (i thought this might be best)
            • 3. Re: ASP help!
              Sutton808303 Level 1
              Is there an extension that I can get that will help me insert the forms and write the ASP code for me? What do you guys normally use?
              • 4. Re: ASP help!
                Level 7
                > Thanks for the quick reply. My host is cool with the cdonts and the form
                > comes
                > through fine. Just not with any info from the radio buttons.
                >
                > I should of mentioned that the ASP code above has any reference to the
                > radio
                > buttons removed (i thought this might be best)


                OK, my bad. I didn't thorougly read your post.

                For the radio button in the form:
                <label>
                <input name="attend" type="radio" id="attend_0" value="Yes, I will
                attend" checked="checked" />
                I will be attending
                </label>
                <br />
                <label>
                <input type="radio" name="attend" value="No, I will not attend"
                id="attend_1" />
                I will NOT be attending
                </label>
                <br />

                and for the code to carry the radio button value:

                ' get posted data into variables
                EmailFrom = "me@mysite.com"
                EmailTo = "me@mysite.com"
                Subject = "Derby RSVP"
                Name = Trim(Request.Form("Name"))
                Email = Trim(Request.Form("Email"))
                Attend = Trim(Request.Form("attend")) 'this is a new line


                ' prepare email body text
                Dim Body
                Body = Body & "Name: " & Name & VbCrLf
                Body = Body & "Email: " & Email & VbCrLf
                Body = Body & "Will I attend? " & Attend & VbCrLf 'this is a new
                line


                This ought to work, but I didn't test it.

                Here's an extension that might help if this doesn't work:
                http://www.dwzone-it.com/ExtensionFree/extfree_how_vc.asp