Link to home
Start Free TrialLog in
Avatar of akbiro
akbiroFlag for United States of America

asked on

Form won't read the .asp file first

Take a look at my form at www.scan2us.com/test.
What I want to happen is for the form to use the send_request.asp file to test the inputs and process the emails before it send the inforamtion to the data base thru the form.ac.asp.  I just can't seem to figure it out.  If you see the error, please tell me so I will learn from this.
<html>
<head>
	<title>SCAN2US - Contact Us</title>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	<meta name="robots" content="INDEX">
	<meta name="Rating" content="General">
	<meta name="Language" content="en">
	<meta name="distribution" content="Global">
	<meta name="Copyright" content="©1996-2006">
	<meta name="Classification" content="Records Management">
	<meta name="Author" content="SCAN2US">
	<meta name="keywords" content="records management, 21 CFR Part 11, archival, repository, secure file sharing, storage of electronic documents, security, SWC, SCAN2US Web Center, miami, florida, document image management, solomon institute corporation, computer filing cabinet, imaging, filing, an affordable paperless office, scan2us, hipaa, hipaa compliance, cfc, cfc server system, cfc standalone, solomon, cross reference, optical character recognition, share network, iron mountain, offsite outsource paperless office, remote access imaging, e-solutions secure collaboration, disaster recovery, document scanning, document storage, electronic file storage, document, images, turnkey, affordable, scaleable, cd-rom, silo, workflow, cold, fujitsu, documentmall, affordable, paperless, cd, dvd, silo">
	<meta name="description" content="The SCAN2US software allows anything that can be printed on your PC to be automatically converted to a print image and stored in your electronic cabinet.">
	<link href="../format.css" rel="stylesheet" type="text/css">
	<script ID="clientEventHandlersJS" LANGUAGE="javascript">
 
function imgSub_onclick()
{
	var nReturn = 0;
 
  if (document.reqinfo.name.value.length == 0)
  {
    alert("Please enter your Name, thank you.");
		document.reqinfo.name.focus();
		document.reqinfo.name.select();
    nReturn = -1;
  }
 
	if (nReturn == 0)
	{
		if (document.reqinfo.email.value.length == 0)
		{
		  alert("Please enter your Email address:, thank you.");
			document.reqinfo.email.focus();
			document.reqinfo.email.select();
		  nReturn = -1;
		}
	}
		if (nReturn == 0)
	{
		if (document.reqinfo.company.value.length == 0)
		{
		  alert("Please enter your Company name, thank you.");
			document.reqinfo.company.focus();
			document.reqinfo.company.select();
		  nReturn = -1;
		}
	}
		if (nReturn == 0)
	{
		if (document.reqinfo.phone.value.length == 0)
		{
		  alert("Please enter your Phone number, thank you.");
			document.reqinfo.phone.focus();
			document.reqinfo.phone.select();
		  nReturn = -1;
		}
	}
 
		if (nReturn == 0)
	{
		if (document.reqinfo.reason.value.length == 0)
		{
		  alert("Please select the type of information you desire, thank you.");
			document.reqinfo.reason.focus();
			document.reqinfo.reason.select();
		  nReturn = -1;
		}
	}
	
	if (nReturn == 0) {
		window.reqinfo.hidAction.value = "S";
		window.reqinfo.submit();
	}
return false;
}
 
</script>
 
<script LANGUAGE="JavaScript">
function SetFocus() {
	document.reqinfo.name.focus();
	document.reqinfo.name.select();
}
</script>
</head>
 
<body>
<div class="layout"> <!-- This opens the tag for centering/spacing the entire page -->
 
<!-- BEGIN Header Information -->
<div class="header">
<div id="headerIMG"><span id="headerTXT"><a href="/">Home</a></span>
<span id="headerTXT"><a href="/solutions/">Solutions</a></span>
<span id="headerTXT"><a href="/downloads/">Downloads</a><img src="../gifjpg/new-b2.gif" width="25" height="15"></span>
<span id="headerTXT"><a href="/features/">Features</a></span>
<span id="headerTXT"><a href="/security/">Security</a></span>
<span id="headerTXT"><a href="/support/">Support</a></span>
<span id="headerTXT"><a href="/contact/">Contact Us</a></span></div>
</div>
<!-- END Header Information -->
 
<div class="qaSpacing">
 
<!-- Schedule and upcoming info boxes: START -->
<div class="boxTwo"><div class="menuLocMid">
<div class="menuLocTop"></div>
	<div id="boxImg" style="margin-top: -4px; padding-left: 5px;"><strong>Contact Us </strong><img src="../gifjpg/stripeRed.gif" style="margin-left: 3px; "></div>
  <p class="boxContOne">	</p>
<div class="menuLocBot"></div>
</div><div class="menuXtraMid">
<div class="menuXtraTop"></div>
<p class="boxXtraOne">SCAN2US demonstration now available. - <a href="javascript:var w=window.open('../marketing.htm','','width=475,height=485,menubar=0,resizable=1,scrollbars=1');"> Click Here</a><br><br>
<img id="imgMenu" src="../gifjpg/radioTower.jpg">	</p><div class="menuLogo"></div>
<div class="menuXtraBot"></div>
</div></div>
 
<div class="contentTwo">
 <STRONG>Contact Us </STRONG>
 <b>Information, Order Trail Software, and Comments are welcomed here:</b><br>
	 <p>	 <b>Please</b> use the following form to request additonal information,  inquire about 
		our products, learn how to qualify to become a dealer, comment on 
		our website, or simply to send us a note. To reach us directly, call  
		1-305-555-5555 (Selection 1).&nbsp; Take us home, use us and become another member of our 
		growing family.</p>
	 <p><b>Thank you</b> for visiting the SCAN2US web site. We pride ourselves in providing excellent service and support with a high level of customer 
		problem solving skills.. We've been at this for a very long time, long 
		enough to understand the importance of making each and every customer 
		happy with our products and services.&nbsp; Our dedication to service and support 
		keeps our customers and partners very loyal to our company and our long 
	  term goals.</p>
	 <p><font color="#ff0000"><b>* denotes a required field.</b>
    </font></p>
	 <form action="form_ac.asp" method="post">
     <table width="450" border="0">
  <tr>
    <th scope="col"><strong>1. Please select the type of information you desire:</strong></th>
    <th scope="col">&nbsp;</th>
  </tr>
  <tr>
  <td>&nbsp;</td>
        <td><select name="reason" size="1" id="reason">
          <option value="0" selected>Select One</option>
          <option value="Brochure.">Brochure</option>
          <option value="30-Day Free Trial.">30_day Trial</option>
          <option value="I'd like dealer information.">Dealer Information</option>
          <option value="This is a special request.">Other</option>
        </select></td>
  </tr>
  <tr>
    <td><strong>2. Enter your information:&nbsp;</strong></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><label for="name">
      <div align="right">Name:</div>
    </label></td>
    <td><input name="name" type="text" id="name" size="26" maxlength="50"><font color="#ff0000"><b>* </b>
    </font></td>
  </tr>
  <tr>
    <td><label for="email-address">
      <div align="right">Email:</div>
    </label></td>
    <td><input name="email" type="text" id="email" size="26" maxlength="50"><font color="#FF0000"><b>*</b></font></td>
  </tr>
  <tr>
    <td><label for="company">
      <div align="right">Company:</div>
    </label></td>
    <td><input name="company" type="text" id="company" size="26" maxlength="50"><font color="#ff0000"><b>*</b></font></td>
  </tr>
  <tr>
    <td><label for="address">
      <div align="right">Street Address:</div>
    </label></td>
    <td><input name="address" type="text" id="address" size="26" maxlength="50"></td>
  </tr>
  <tr>
    <td><label for="city_state">
      <div align="right">City & State:</div>
    </label></td>
    <td><input name="city_state" type="text" id="city_state" size="26" maxlength="50"></td>
  </tr>
  <tr>
    <td><label for="zip">
      <div align="right">Zip:</div>
    </label></td>
    <td><input name="zip" type="text" id="zip" size="26" maxlength="50"></td>
  </tr>
  <tr>
    <td><label for="phone">
      <div align="right">Phone:</div>
    </label></td>
    <td><input name="phone" type="text" id="phone" size="26" maxlength="50"><font color="#ff0000"><b>*</b></font></td>
  </tr>
  <tr>
    <td><strong>3. Enter your inquiry, request or comment:</strong></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><label for="comments">
      <div align="right">Comments:</div>
    </label></td>
    <td><textarea name="comments" id="comments" cols="23" rows="3"></textarea></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><div align="right">
      <input name="reset" type="reset" value="Reset">
      <input TYPE="hidden" NAME="hidAction" VALUE="O">
    </div></td>
    <td> <input onClick="return imgSub_onclick();" TYPE="submit" name="btnSubmit" value="Send">   
         
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
 
     
     
     </form>
	  <p><b>In the event of an error, please contact us using the following information :</b>
     <ul type="disc">
<li><a href="mailto:blah@domain.com">blah@domain.com</a> - e-mail our customer service department</li>
<li><a href="mailto:blah@domain.com">blah@domain.com</a> - e-mail technical support</li>
<li><a
         href="mailto:blah@domain.com">blah@domain.com</a> - e-mail website webmaster</li>
<li>Phone - 1-305-555-5555 (Sales Section 1)</li>
<li>Fax -305-555-5556</li>
<li>Local Address:
  <ul type="circle">
   <li>2877 S.W. 69th Court<br>
West Place, MI 21212</li>
  </ul>
</li>
     </ul>
 <p>&nbsp;</p>
 <p>&nbsp;</p>
 </div>
</div>
 
<!-- BEGIN Footer Information -->
<div class="footer"><div id="footerTXT">| All Rights Reserved - Copyright &copy; 2008 SCAN2US, LLC<br>
<a href="/legal/copyright.htm">Copyright</a> | <a href="/legal/privacy.htm">Privacy Policy</a> | <a href="/contact/">Contact Us</a>
</div></div>
<!-- END Footer Information -->
</div> 
<!-- This closes the tag for centering/spacing the entire page -->
</body>
</html>

Open in new window

Avatar of Kevin Cross
Kevin Cross
Flag of United States of America image

akbiro,

Unless I am reading this incorrectly, you are not sending to send_request.asp first:
 <form action="form_ac.asp" method="post">

Since your form is submitting to form_ac.asp, that code will take place.  Try changing the form tag to use send_request.asp as long as after the email is submitted you send the same values over to form_ac.asp.  Think Server.transfer will work well for you in this instance: http://www.w3schools.com/ASP/met_transfer.asp.  Or make one page that has all the code to send e-mail and upload data to database and use that in your form action.

Hope that helps.

isa
Avatar of akbiro

ASKER

Sound like a great fiid.  Pretend I am a six year old.  Where do I place the server transfer?  Thanks for the quick responce.

(ADMIN EDIT: obscure personal information and e-mail addresses)
<%@ LANGUAGE=VBScript %>
<%
	Option Explicit
 
	Response.Buffer = true
	Response.Clear 
 
	'Here is a VBScript example of how CDO can be used to deliver a message through the SMTP service:
	Dim szBody, oMail
	
	Set oMail = Server.CreateObject("CDO.Message")
 
	oMail.From = Request.Form.item("email")
 
	oMail.To = "blah@domain.com, himtoo@thatplace.com, andher@someisp.net"
 
	oMail.Subject = "SCAN2US Web Contact Information"
 
    oMail.TextBody =  "Name :  " & Request.Form.item("name") & vbcrlf _
					& "Desired Information :  " & Request.Form.item("reason") & vbcrlf _
					& "Company :  " & Request.Form.item("company") & vbcrlf _
					& "Address :  " & Request.Form.item("address") & vbcrlf _
					& "City/State :  " & Request.Form.item("citystate") & vbcrlf _
					& "Zip :  " & Request.Form.item("zip") & vbcrlf _
					& "Phone :  " & Request.Form.item("phone") & vbcrlf _ 
					& "Email :  " & Request.Form.item("email") & vbcrlf _
					& "Comments :  " & Request.Form.item("comments")
 
	oMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "xx.xxx.xxx.xxx"
 
    oMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
 
   	oMail.Configuration.Fields.Update
 
	oMail.Send
 
	Set oMail = Nothing
	
	'------------------------------------------------------------------------------------------------
	' Thank You
	'------------------------------------------------------------------------------------------------
	
	Set oMail = Server.CreateObject("CDO.Message")
 
	oMail.From = "blah@domain.com, himtoo@thatplace.com"
 
	oMail.To = Request.Form.item("email")
 
	oMail.Subject = "SCAN2US Contact Confirmation"
 
    	oMail.TextBody = "Dear " & Request.Form.item("name") & " " & "," & vbcrlf _
					& " " & vbcrlf _
					& "Thank you for contacting SCAN2US! This is an automatic reply to let you know we have successfully received your request for information. If you have requested Trail Software we will need to set up your File Room, some simple security and provide you with authenication passcodes." & vbcrlf _
					& " " & vbcrlf _
					& "A SCAN2US representative will contact you within 24 hours." & vbcrlf _
					& " " & vbcrlf _
					& " " & vbcrlf _					
					& "Best Regards, " & vbcrlf _
					& " " & vbcrlf _
					& "Business Development Team" & vbcrlf _
					& "--SCAN2US, LLC--"
 
    	oMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "xx.xxx.xxx.xxx"
 
    	oMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
 
    	oMail.Configuration.Fields.Update
 
	oMail.Send
 
	Set oMail = Nothing
 
%>
<HTML>
<HEAD>
<META NAME='GENERATOR' Content='Microsoft Visual Studio 6.0'>
	<meta http-equiv="refresh" content="15;URL=/contact/">
	<link href="../format.css" rel="stylesheet" type="text/css">
<TITLE>Thank You</TITLE>
</HEAD>
<BODY>
<div class="layout"> <!-- This opens the tag for centering/spacing the entire page -->
 
<!-- BEGIN Header Information -->
<div class="header">
<div id="headerIMG"><span id="headerTXT"><a href="/">Home</a></span><span id="headerTXT"><a href="/solutions/">Solutions</a></span><span id="headerTXT"><a href="/features/">Features</a></span><span id="headerTXT"><a href="/security/">Security</a></span><span id="headerTXT"><a href="/support/">Support</a></span><span id="headerTXT"><a href="/contact/">Contact Us</a></span></div>
</div>
<!-- END Header Information -->
 
<div class="qaSpacing">
 
<!-- Schedule and upcoming info boxes: START -->
<div class="boxTwo"><div class="menuLocMid">
<div class="menuLocTop"></div>
	<div id="boxImg" style="margin-top: -4px; padding-left: 5px;"><strong>Contact Us </strong><img src="../gifjpg/stripeRed.gif" style="margin-left: 3px; "></div>
  <p class="boxContOne">	</p>
<div class="menuLocBot"></div>
</div><div class="menuXtraMid">
<div class="menuXtraTop"></div>
<p class="boxXtraOne">SCAN 2US demonstration now available. - <a href="/demo.htm">Click Here</a><br><br>
<img id="imgMenu" src="../gifjpg/radioTower.jpg">	</p><div class="menuLogo"></div>
<div class="menuXtraBot"></div>
</div></div>
 
<div class="contentTwo">
 	 <font size="2"><p><b>Thank you!</b> </p>
	 <p>We've received your request for information. A  representative will 
            contact you shortly. Thank You!<br>
            <br>
            In a moment, you will be returned to the 
      Contact Us section.<br>
To reach us immediately, call  <b>1-305-267-4888 (Sales Section 1)</b></p></font>
 
<p><b>In the event of an error, please contact us using the following information :</b>
     <ul type="disc">
<li><a href="mailto:blah@domain.com">blah@domain.com</a> - e-mail our customer service department</li>
<li><a href="mailto:blah@domain.com">blah@domain.com</a> - e-mail technical support</li>
<li><a
         href="mailto:blah@domain.com">blah@domain.com</a> - e-mail website webmaster</li>
<li>Phone - 1-305-555-5555 (Sales Section 1)</li>
<li>Fax -305-555-5556</li>
<li>Local Address:
  <ul type="circle">
   <li>2877 S.W. 69th Court<br>
West Place, MI 21212</li>
  </ul>
</li>
     </ul>
 <p>&nbsp;</p>
 <p>&nbsp;</p>
 <p>&nbsp;</p>
 <p>&nbsp;</p>
 <p>&nbsp;</p>
 </div>
</div>
 
<!-- BEGIN Footer Information -->
<div class="footer">
  <div id="footerTXT">Toll Free: 1-305-555-5555  | All Rights Reserved - Copyright &copy; 2009 SCAN2US, LLC<br>
<a href="/legal/copyright.htm">Copyright</a> | <a href="/legal/privacy.htm">Privacy Policy</a> | <a href="/contact/">Contact Us</a>
</div></div>
<!-- END Footer Information -->
</div> 
<!-- This closes the tag for centering/spacing the entire page -->
</body>
</html>

Open in new window

See notes in code.

(ADMIN EDIT: obscure personal information)
<%@ LANGUAGE=VBScript %>
<%
	Option Explicit
	 
		Response.Buffer = true
		Response.Clear 
	 
		'Here is a VBScript example of how CDO can be used to deliver a message through the SMTP service:
		Dim szBody, oMail
		
		Set oMail = Server.CreateObject("CDO.Message")
	 
		oMail.From = Request.Form.item("email")
	 
		oMail.To = "blah@domain.com, himtoo@thatplace.com, andher@someisp.net"
	 
		oMail.Subject = "SCAN2US Web Contact Information"
	 
	    oMail.TextBody =  "Name :  " & Request.Form.item("name") & vbcrlf _
						& "Desired Information :  " & Request.Form.item("reason") & vbcrlf _
						& "Company :  " & Request.Form.item("company") & vbcrlf _
						& "Address :  " & Request.Form.item("address") & vbcrlf _
						& "City/State :  " & Request.Form.item("citystate") & vbcrlf _
						& "Zip :  " & Request.Form.item("zip") & vbcrlf _
						& "Phone :  " & Request.Form.item("phone") & vbcrlf _ 
						& "Email :  " & Request.Form.item("email") & vbcrlf _
						& "Comments :  " & Request.Form.item("comments")
	 
		oMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "xx.xxx.xxx.xxx"
	 
	    oMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
	 
	   	oMail.Configuration.Fields.Update
	 
		oMail.Send
	 
		Set oMail = Nothing
		
		'------------------------------------------------------------------------------------------------
		' Thank You
		'------------------------------------------------------------------------------------------------
		
		Set oMail = Server.CreateObject("CDO.Message")
	 
		oMail.From = "blah@domain.com, himtoo@thatplace.com"
	 
		oMail.To = Request.Form.item("email")
	 
		oMail.Subject = "SCAN2US Contact Confirmation"
	 
	    	oMail.TextBody = "Dear " & Request.Form.item("name") & " " & "," & vbcrlf _
						& " " & vbcrlf _
						& "Thank you for contacting SCAN2US! This is an automatic reply to let you know we have successfully received your request for information. If you have requested Trail Software we will need to set up your File Room, some simple security and provide you with authenication passcodes." & vbcrlf _
						& " " & vbcrlf _
						& "A SCAN2US representative will contact you within 24 hours." & vbcrlf _
						& " " & vbcrlf _
						& " " & vbcrlf _					
						& "Best Regards, " & vbcrlf _
						& " " & vbcrlf _
						& "Business Development Team" & vbcrlf _
						& "--SCAN2US, LLC--"
	 
	    	oMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "xx.xxx.xxx.xxx"
	 
	    	oMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
	 
	    	oMail.Configuration.Fields.Update
	 
		oMail.Send
	 
	Set oMail = Nothing
 
        '**** PROCESS DATABASE INSERT HERE ****
        'Using server transfer to form_ac.asp, will transfer control to form_ac page while maintaining session/request variables.
        'Therefore, the thank you HTML code will not be displayed from send_request.asp and would need to be moved to form_ac.asp.
        Server.Transfer "form_ac.asp"
 
        'ALTERNATIVELY: move code to insert into database here.
%>

Open in new window

Second alternative listed, would allow you to leave the thank you HTML in place as you are remaining on current page and just moving code from form_ac.asp to point specified.  This is one or the other, so moving code would not use Server.Transfer and vice versa.
Avatar of akbiro

ASKER

Thank you very much...I am working on applying your suggestions.  I will know if I got it in a few minutes.  Thanks for think in my behave.  
You are most welcome.  Just let me know (post back) if you need any further assistance as I and other experts are here to assist.

Best regards,
isa
Avatar of akbiro

ASKER

thank you again
Avatar of akbiro

ASKER

Could you tell me if I did this right.  I uploaded it with all the correct data back in and it fails...you can see what it does at www.scan2us.com/test.  Thanks!!
<%@ LANGUAGE=VBScript %>
<%
	Option Explicit
 
	Response.Buffer = true
	Response.Clear 
 
	'Here is a VBScript example of how CDO can be used to deliver a message through the SMTP service:
	Dim szBody, oMail
	
	Set oMail = Server.CreateObject("CDO.Message")
 
	oMail.From = Request.Form.item("email")
 
	oMail.To = "blabla.bla"
 
	oMail.Subject = "SCAN2US Web Contact Information"
 
    oMail.TextBody =  "Name :  " & Request.Form.item("name") & vbcrlf _
					& "Desired Information :  " & Request.Form.item("reason") & vbcrlf _
					& "Company :  " & Request.Form.item("company") & vbcrlf _
					& "Address :  " & Request.Form.item("address") & vbcrlf _
					& "City/State :  " & Request.Form.item("citystate") & vbcrlf _
					& "Zip :  " & Request.Form.item("zip") & vbcrlf _
					& "Phone :  " & Request.Form.item("phone") & vbcrlf _ 
					& "Email :  " & Request.Form.item("email") & vbcrlf _
					& "Comments :  " & Request.Form.item("comments")
 
	oMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "xxxxxxxxx"
 
    oMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = x
 
   	oMail.Configuration.Fields.Update
 
	oMail.Send
 
	Set oMail = Nothing
	
	'------------------------------------------------------------------------------------------------
	' Thank You
	'------------------------------------------------------------------------------------------------
	
	Set oMail = Server.CreateObject("CDO.Message")
 
	oMail.From = "blah.@bla.com"
 
	oMail.To = Request.Form.item("email")
 
	oMail.Subject = "SCAN2US Contact Confirmation"
 
    	oMail.TextBody = "Dear " & Request.Form.item("name") & " " & "," & vbcrlf _
					& " " & vbcrlf _
					& "Thank you for contacting SCAN2US! This is an automatic reply to let you know we have successfully received your request for information. If you have requested Trail Software we will need to set up your File Room, some simple security and provide you with authenication passcodes." & vbcrlf _
					& " " & vbcrlf _
					& "A SCAN2US representative will contact you within 24 hours." & vbcrlf _
					& " " & vbcrlf _
					& " " & vbcrlf _					
					& "Best Regards, " & vbcrlf _
					& " " & vbcrlf _
					& "Business Development Team" & vbcrlf _
					& "--SCAN2US, LLC--"
 
    	oMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "xxxxxxxx"
 
    	oMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
 
    	oMail.Configuration.Fields.Update
 
	oMail.Send
 
	Set oMail = Nothing
	
 
  ' Declaring variables
   Dim reason, name, email, company, address, city_state, zip, phone, comments, sql_insert
 
   ' A Function to check if some field entered by user is empty
   Function ChkString(string)
   If string = "" Then string = " "
   ChkString = Replace(string, "'", "''")
   End Function
 
   ' Receiving values from Form
   reason = ChkString(Request.Form("reason"))
   name = ChkString(Request.Form("name"))
   email = ChkString(Request.Form("email"))
   company = ChkString(Request.Form("company"))
   address = ChkString(Request.Form("address"))
   city_state = ChkString(Request.Form("city_state"))
   zip = ChkString(Request.Form("zip"))
   phone = ChkString(Request.Form("phone"))
   comments = ChkString(Request.Form("comments"))
     
   data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _ 
            Server.MapPath("form.mdb")
   sql_insert = "insert into users (reason, name, email, company, address, city_state, zip, phone, comments) values ('" & _
            reason & "', '" & name & "', '" & email & "', '" & company & "', '" & address & "', '" & city_state & "', '" & zip & "', '" & phone & "', '" & comments & "')"
			
   ' Creating Connection Object and opening the database
   Set con = Server.CreateObject("ADODB.Connection")
   con.Open data_source
   con.Execute sql_insert
   ' Done. Close the connection
   con.Close
   Set con = Nothing
   Response.Write "All records were successfully entered into the database."
%>
<HTML>
<HEAD>
<META NAME='GENERATOR' Content='Microsoft Visual Studio 6.0'>
	<meta http-equiv="refresh" content="15;URL=/contact/">
	<link href="../format.css" rel="stylesheet" type="text/css">
<TITLE>Thank You</TITLE>
</HEAD>
<BODY>
<div class="layout"> <!-- This opens the tag for centering/spacing the entire page -->
 
<!-- BEGIN Header Information -->
<div class="header">
<div id="headerIMG"><span id="headerTXT"><a href="/">Home</a></span><span id="headerTXT"><a href="/solutions/">Solutions</a></span><span id="headerTXT"><a href="/features/">Features</a></span><span id="headerTXT"><a href="/security/">Security</a></span><span id="headerTXT"><a href="/support/">Support</a></span><span id="headerTXT"><a href="/contact/">Contact Us</a></span></div>
</div>
<!-- END Header Information -->
 
<div class="qaSpacing">
 
<!-- Schedule and upcoming info boxes: START -->
<div class="boxTwo"><div class="menuLocMid">
<div class="menuLocTop"></div>
	<div id="boxImg" style="margin-top: -4px; padding-left: 5px;"><strong>Contact Us </strong><img src="../gifjpg/stripeRed.gif" style="margin-left: 3px; "></div>
  <p class="boxContOne">	</p>
<div class="menuLocBot"></div>
</div><div class="menuXtraMid">
<div class="menuXtraTop"></div>
<p class="boxXtraOne">SCAN 2US demonstration now available. - <a href="/demo.htm">Click Here</a><br><br>
<img id="imgMenu" src="../gifjpg/radioTower.jpg">	</p><div class="menuLogo"></div>
<div class="menuXtraBot"></div>
</div></div>
 
<div class="contentTwo">
 	 <font size="2"><p><b>Thank you!</b> </p>
	 <p>We've received your request for information. A  representative will 
            contact you shortly. Thank You!<br>
            <br>
            In a moment, you will be returned to the 
      Contact Us section.<br>
To reach us immediately, call  <b>1-305-267-4888 (Sales Section 1)</b></p></font>
 
<p><b>In the event of an error, please contact us using the following information :</b>
     <ul type="disc">
<li><a href="mailto:hmeyer@scan2us.com">support@scan2us.com</a> - e-mail our customer service department</li>
<li><a href="mailto:hmeyer@scan2us.com">sales@scan2us.com</a> - e-mail technical support</li>
<li><a
         href="mailto:hmeyer@scan2us.com">webmaster@scan2us.com</a> - e-mail website webmaster</li>
<li>Phone - 1-305-267-4888 (Sales Section 1)</li>
<li>Fax -305-433-2278</li>
<li>Local Address:
  <ul type="circle">
   <li>2877 S.W. 69th Court<br>
Miami, Florida 33155</li>
  </ul>
</li>
     </ul>
 <p>&nbsp;</p>
 <p>&nbsp;</p>
 <p>&nbsp;</p>
 <p>&nbsp;</p>
 <p>&nbsp;</p>
 </div>
</div>
 
<!-- BEGIN Footer Information -->
<div class="footer">
  <div id="footerTXT">Toll Free: 1-305-267-4888  | All Rights Reserved - Copyright &copy; 2009 SCAN2US, LLC<br>
<a href="/legal/copyright.htm">Copyright</a> | <a href="/legal/privacy.htm">Privacy Policy</a> | <a href="/contact/">Contact Us</a>
</div></div>
<!-- END Footer Information -->
</div> 
<!-- This closes the tag for centering/spacing the entire page -->
</body>
</html>

Open in new window

That looks good to me.

Just note that you may have to ensure that this line:
 Response.Write "All records were successfully entered into the database."

Shows correctly with the rest of your page as it will get processed before the other HTML code, so will probably sit outside your page design/layout.
Avatar of akbiro

ASKER

Could you just take a look at www.scan2us.com/test and tell me why it is not executing the .asp file.  I have it loaded properly on the server.  I think this will be my last need...I hope!
This is the error message I get (see code snippet).

As referenced by the error message, the variable data_source is not defined; therefore, you need to add a 'Dim data_source' to your code.

For better understanding, here is a definition of this error from http://classicasp.aspfaq.com/general/why-do-i-get-800a01f4-errors.html:
"If you use Option Explicit, you've probably seen this error...This usually means you created a variable somewhere in your script, but did not define it with a dim statement."

Sorry I didn't catch that earlier as it appeared that you had a Dim statement for all your variables.  And you are indeed using Option Explicit.
Microsoft VBScript runtime error '800a01f4'
 
Variable is undefined: 'data_source'
 
/test/form_ac_send_req.asp, line 94

Open in new window

Avatar of akbiro

ASKER

Everything checks out.  I have it all in and spelling is correct, the mdb file is good.  My first concern is that it is not checking for the required fields, it is just skipping over that whole routine and trying to write to the database.  If fails to write , but it first fails to test for the correct entries.  I hope this is OK to pursue...I really need this to work.  Thanks again for you patience with me.
ASKER CERTIFIED SOLUTION
Avatar of Kevin Cross
Kevin Cross
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of akbiro

ASKER

Good job and THANK you for not giving up on me.  I know I used a lot of your time and brain cells.  I might have another question about how to get the return email to the user to work...but I will work on that tomorrow.  Thanks again...we all appreciate this great service.  Take the rest of the day off!
:) You are welcome.

Glad that worked for you.

Best regards,
mwvisa1