Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Sep 2011
    Posts
    57
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Sending data to another form

    Trying to send some variables over to another contact form page, but it's not working out for me and I have to finish this by noon today .

    The first form is 3 questions, then when you submit, it will take you to a contact form where you can complete the registration process. Problem is that its not putting in the variables from the previous page when the final form is submitted. Not sure what I'm doing wrong.

    Here is the code for part 1 of the form on the first page:
    Code:
    <form name="sending" method="POST" action="contact-us.asp" target="_self"> 
        
        <table border=0 z id="form" style="padding:0px;">
    		<tr>
    			<td align="right">
    				Area of Practice
    			</td>
    			<td align="left">
    				<table class="area_ofpractice" cellpadding="0" cellspacing="0">
    					<tr>
    						<td>
                        <select name="occupation">
    							
                                <option></option>
    								<option>Allergy & Immunology </option><option>Anesthesiology </option><option>Bariatric Surgery </option><option>Cardiology</option><option>Cosmetic Surgeon </option><option>Dermatology </option><option>Emergency Medicine </option><option>Endocrinology, Diabetes, & Metabolism </option><option>Family Practice </option><option>Gastroenterology </option><option>General Practice </option><option>Geriatrics</option>
                                    <option>Gynecology </option><option>Hematology  </option><option>Infectious Disease </option><option>Internal Medicine </option><option>Nephrology </option><option>Neurological Surgery </option><option>Neurology </option><option>Obstetrics/Gynecology </option><option>Oncology  </option><option>Ophthalmology</option><option>Orthopedic Surgery </option><option>Otolaryngology </option>
                                     <option>Pain Management </option><option>Pathology </option><option>Pediatrics </option><option>Physical Medicine & Rehabilitation </option><option>Plastic Surgery </option><option>Preventive Medicine </option><option>Psychiatry</option><option>Pulmonary Surgery </option><option>Pulmonology (without surgery) </option><option>Radiology Urology</option><option>Rheumatology </option><option>Vascular Surgery</option>
    							</select>
    						</td>
                  
    					</tr>
    				</table>
    			</td>
    		</tr>
    		
    		<tr>
    			<td align="right">
    				State of Practice
    			</td>
    			<td align="left">
    				<table class="state_ofpractice" cellpadding="0" cellspacing="0">
    					<tr>
    						<td>
    							<select name="drop_down2">
    								<option></option><option>Arizona</option><option>Arkansas</option><option>California</option><option>Connecticut</option><option>Delaware</option><option>Florida</option><option>Georgia</option><option>Illinois</option><option>Indiana</option><option>Kentucky</option><option>Maryland</option><option>Massachusetts</option><option>Michigan</option>Missouri</option><option>Montana</option><option>New Jersey</option><option>New York</option><option>North Carolina</option><option>Ohio</option><option>Oklahoma</option><option>Pennsylvania</option><option>South Carolina</option><option>Tennessee</option><option>Texas</option><option>Virginia</option><option>Washington</option><option>West Virginia</option>
    							</select>
    						</td>
    					</tr>
    				</table>
    			</td>
    		</tr>
            
            <tr>
    			<td align="right">
    				Are you Insured?
    			</td>
    			<td align="left">
    				<table class="are_youinsured" cellpadding="0" cellspacing="0">
    					<tr>
    						<td>
                            
    							<select name="drop_down3">
    								<option></option><option>Yes, I do carry malpractice insurance</option><option>No, I do not carry malpractice insurance. </option><option>I'm thinking about going bare</option>
    							</select>
    						</td>
    					</tr>
    				</table>
    			</td>
    		</tr>
            
    		
    
    		<tr>
    			<td></td>
    			<td style="padding:2px;">
                
    				<input type="submit" button value="Sign Up Now" name="submit">
    			
    			</td>
    		</tr>
    	</table>
    </form>
    then here is the code on the page that should be receiving those variables and then sending them out at the end:

    Code:
    <% @LANGUAGE = "VBScript" %>
    <%
    ' ===================================================
    ' Receives Form and uses SENDMAIL to email the result
    ' to an email address 
    '====================================================
    Dim StrTitle,StrMethod,StrUrl,result
    Dim StrBodyHtml,oMail,StrEmail,strFrom,strReply,strSubject,FormSubmitted
    	
    	'strMethod=Ucase(Request.ServerVariables("Request_Method"))
    	'strTitle=Ucase(Request.ServerVariables("Server_Name")) & "InfoRequest" 
    	'strUrl=Lcase(Request.ServerVariables("URL"))
     ' with Response     End With doesn't work with the development server
     
    if Request("FormSubmitted") Then
    
    '==================================CAPTCHA ====================================
    Function CheckCAPTCHA(valCAPTCHA)
    	SessionCAPTCHA = Trim(Session("CAPTCHA"))
    	Session("CAPTCHA") = vbNullString
    	if Len(SessionCAPTCHA) < 1 then
            CheckCAPTCHA = False
            exit function
        end if
    	if CStr(SessionCAPTCHA) = CStr(valCAPTCHA) then
    	    CheckCAPTCHA = True
    	else
    	    CheckCAPTCHA = False
    	end if
    End Function
    
    if Request.ServerVariables("REQUEST_METHOD") = "POST" then
    	strCAPTCHA = Trim(Request.Form("strCAPTCHA"))
    
      if CheckCAPTCHA(strCAPTCHA) = true then	
      StrBodyHtml= " Urgent! - Following message was received Via website "  & "<br>" 
      StrBodyHtml=StrBodyHtml & " --------------------------------------------------------- " & "<br><br><br>"
      StrBodyHtml=StrBodyHtml & "<b>Name: </b>" & Request("txtFirst") & "<br>" 
      StrBodyHtml=StrBodyHtml & "<b>Property Address: </b>" & Request("txtAddress") & "<br>" 
      StrBodyHtml=StrBodyHtml & "<b>City St, Zip: </b>" & Request("txtCity") & ", " & Request("txtSt") & " "  & Request("txtZip") & "<br>"
      StrBodyHtml=StrBodyHtml & "<b>Email Address: </b>" & Request("txtEmail") & "<br>" 
      StrBodyHtml=StrBodyHtml & "<b>Phone: </b>" & Request("txtTel1") & "<br>" 
      StrBodyHtml=StrBodyHtml & "<b>Alternate Phone: </b>" & Request("txtTel2") & "<br>"   
      StrBodyHtml=StrBodyHtml & "<b>Message: </b>" & Request("txtMsg") & "<br><br>" 
       StrBodyHtml=StrBodyHtml & "<b>Occupation: </b>" & Request.form ("occupation") & "<br><br>"
    
    'General Information =========================
    	strEmail = Request("txtemail")
    	strFrom = Request("txtEmail")
    	strReply = Request("txtEmail")
    	strSubject = "Lubell Rosen Website - On-Line Information Request Part 2"
        Set oMail = Server.CreateObject("CDONTS.Newmail")
           oMail.To = "je@jonathaneiger.com"
           'oMail.To = "kavizad@yahoo.com"
           oMail.From = strFrom
           'oMail.Value("Reply-To") = strReply
           oMail.BodyFormat = 0
           oMail.MailFormat = 0
           oMail.Subject = strSubject
           oMail.Body = strBodyHTML
       result = oMail.Send 
           Set oMail = Nothing
     'response.redirect("./InfoReqThanks.htm")
     %>
    this is the form for that page:

    Code:
    <form action="contact-us.asp" method="post" name="frmInfo" id="frmInfo"  onsubmit="return checkEmail(txtEmail.value)">
                              <input type="hidden" name="formSubmitted" value="True" />
                              <table width="100%" border="0" class="bodytextbig">
                                <tr align="left" valign="top"> 
                                  <td colspan="2" height="41"><font color="#000000">You may also complete 
                                    the following form and we will contact you. <font color="b3013c"><strong>(* 
                                    Required Fields)</strong></font><br />
                                    Your personal information cannot be sold or given 
                                    to any other party.</font></td>
                                </tr>
                                <tr> 
                                  <td width="25%"><font color="#000000">Name:</font><font color="b3013c"><strong>*</strong></font></td>
                                  <td width="75%"> <input class="frm" type="text" name="txtFirst" maxlength="20" /> 
                                  </td>
                                </tr>
                                <tr> 
                                  <td width="25%"><font color="#000000">Address:</font></td>
                                  <td width="75%"> <input class="frm" type="text" name="txtAddress" size="30" maxlength="35" /> 
                                  </td>
                                </tr>
                                <tr> 
                                  <td width="25%"><font color="#000000">City:</font></td>
                                  <td width="75%"> <input class="frm" type="text" name="txtCity" maxlength="25" /> 
                                  </td>
                                </tr>
                                <tr> 
                                  <td width="25%"><font color="#000000">State:</font></td>
                                  <td width="75%"> <input class="frm" type="text" name="txtSt" size="2" maxlength="2" /> 
                                  </td>
                                </tr>
                                <tr> 
                                  <td width="25%"><font color="#000000">Zip Code:</font></td>
                                  <td width="75%"> <input class="frm" type="text" id="Zip" name="txtZip" size="5" maxlength="5" /> 
                                  </td>
                                </tr>
                                <tr> 
                                  <td width="25%"><font color="#000000">E-Mail:</font><font color="b3013c"><strong>*</strong></font></td>
                                  <td width="75%"> <input class="frm" type="text" id="Email" name="txtEmail" size="40" maxlength="45" /> 
                                  </td>
                                </tr>
                                <tr> 
                                  <td width="25%"><font color="#000000">Confirm E-Mail:</font><font color="b3013c"><strong>*</strong></font></td>
                                  <td width="75%"> <input class="frm" type="text" id="Email" name="txtEmail2" size="40" maxlength="45" /> 
                                  </td>
                                </tr>
                                <tr> 
                                  <td width="25%"><font color="#000000">Phone:</font><font color="b3013c"><strong>*</strong></font></td>
                                  <td width="75%"> <input class="frm" type="text" id="DayPhone" name="txtTel1" size="14" maxlength="20" /> 
                                  </td>
                                </tr>
                                <tr> 
                                  <td width="25%"><nobr><font color="#000000">Alternate Phone:</font></nobr></td>
                                  <td width="75%"> <input class="frm" type="text" id="EvePhone" name="txtTel2" size="14" maxlength="20" /> 
                                  </td>
                                </tr>
                                <tr> 
                                  <td valign="top" width="25%"><font color="#000000">Comments:</font><font color="b3013c"><strong>*</strong></font></td>
                                  <td align="left" width="75%"> <textarea class="frm" rows="5" cols="42" id="Comments" name="txtMsg"></textarea> 
                                    <br /> </td>
                                </tr>
                                <tr> 
                                  <td align="left" valign="top"><font color="#000000">Please Enter Code:</font></td>
                                  <td align="left"><img src="aspcaptcha.asp" alt="Enter Code Below" width="86" height="21" /><br /> 
                                    <input name="strCAPTCHA" value="" size="12" /> 
                                  </td>
                                </tr>
                                <tr> 
                                  <td align="left" valign="top">&nbsp;</td>
                                  <td align="left"><input class="frm" type="submit" value="Submit" name="submit" /></td>
                                  
                                  <input type="hidden" name="occupation" />
                                  
                                </tr>
                              </table>
                            </form>

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,613
    Thanks
    80
    Thanked 4,635 Times in 4,597 Posts
    My head hurts.

    Your first page with the 3 questions submits the answers to those questions to the page contact-us.asp.

    And your last page with all the other questions DOES THE SAME THING.

    So how is the page contact-us.asp supposed to know what to do???

    I can't make sense of the order you are doing things.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    New Coder
    Join Date
    Sep 2011
    Posts
    57
    Thanks
    8
    Thanked 0 Times in 0 Posts
    sorry.

    The 2nd part of the form has the instructions on what to do when the user submits the form. Whats the user submits an echo is sent out saying that you have submitted the form successfully and then it returns back to the contact page.

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,613
    Thanks
    80
    Thanked 4,635 Times in 4,597 Posts
    I am referring to this:
    Code:
    <form name="sending" method="POST" action="contact-us.asp" target="_self">
    and this
    Code:
    <form action="contact-us.asp" method="post" name="frmInfo" id="frmInfo"  ... >
    BOTH FORMS send their form data to the SAME asp page.

    If that page "contact-us.asp" is the one the you show as the middle of your three code blocks, then it can't possibly work. You can't send part of the data one time and part another time and expect the ASP code to somehow magically put them both together.

    You FIRST page should *probably* do something like
    Code:
    <form name="sending" method="POST" action="secondFormPage.asp" target="_self">
    and then your second form page *must* be an ASP page--NOT an HTML page--and it could then include the data from the first page in the form fields it finally sends to "contact-us.asp".

    It could do so by copying the form data from the first page into HIDDEN form fields on itself or by storing the form data from the first page in Session variables. I would personally recommend using hidden form fields.

    So...

    Page: secondFormPage.asp
    Code:
    <form action="contact-us.asp" method="post" name="frmInfo" id="frmInfo"  ... >
    
    <input type="hidden" name="occupation" value="<%=Request("occupation")%>" />
    <input type="hidden" name="drop_down2" value="<%=Request("drop_down2")%>" />
    <input type="hidden" name="drop_down3" value="<%=Request("drop_down3")%>" />
    
    ... rest of form as is ...
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    eiger23 (01-16-2012)

  • #5
    New Coder
    Join Date
    Sep 2011
    Posts
    57
    Thanks
    8
    Thanked 0 Times in 0 Posts
    I got it! Thanks a lot for your help. I see where I went wrong.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •