I've created an asp page that contains a form (Supplier_Reg.asp). Once the user clicks submit, the form is validated (using an external script for validating only - validateform.
js); an access database is updated and a Thank you page opens (addsupplier.asp). These pages work with the db being updated and the thank you page appearing.
I also created two other pages (for testing purposes because I'd never worked with CDONTS) where I created a form (input.asp) that when the user clicks submit, an email using CDONTS that contains the contents from the form is sent to a hidden address and a thank you page appears (output.asp).
My question is: How would I combine the two pieces? My end result should be the user fills out the form from Supplier_Reg.asp; when they click Submit it posts to addsupplier.asp; the form is validated and an email is sent which contains the contents of the form AND a small text message).
Code for Supplier_Reg.asp is as follows:
<html>
<head>
<title>Registration Form Page</title>
<script language="JavaScript" src="validateform.
js" type="text/javascript"></script>
</head>
<body>
<br><b>- Registration Form -</b>
<table BORDER=1 CELLSPACING=0 CELLPADDING=2 WIDTH="100%" BGCOLOR="#C7C8C9" >
<tr>
<td><form name="supplyreg" method="post" action="addsupplier.asp">
<table BORDER=0 CELLSPACING=0 CELLPADDING=3 WIDTH="100%" >
<tr ALIGN=LEFT VALIGN=TOP>
<td>Company Name</td>
<td><input type="text" name="D_Company" size="35" maxlength="35"></td>
</tr>
<tr>
<td>Address</td>
<td><input type="text" name="D_Address" size="45" maxlength="45"></td>
</tr>
<tr>
<td>City, State, Zip</td>
<td><input type="text" name="D_City" size="35" maxlength="35"><input type="text" name="D_State" size="2" maxlength="2"><input type="text" name="D_Zip" size="5" maxlength="5"></td>
</tr>
<tr ALIGN=LEFT VALIGN=TOP>
<td>Phone</td>
<td><input type="text" name="D_Phone" size="14" maxlength="14"></td>
</tr>
<tr>
<td>Fax</td>
<td><input type="text" name="D_Fax" size="14" maxlength="14"></td>
</tr>
<tr>
<td>Website Address</td>
<td><input type="text" name="D_Website" size="50" maxlength="50"></td>
</tr>
<tr>
<td>Contact Person</td>
<td><input type="text" name="D_Contact" size=35 maxlength=35></td>
</tr>
<tr>
<td>Contact Phone</td>
<td><input type="text" name="D_CPhone" size=14 maxlength=14></td>
</tr>
<tr>
<td>Contact Email (Please check for accuracy prior to submission)</td>
<td><input type="text" name="D_Email" size=40 maxlength=40></td>
</tr>
<tr>
<td>Products and/or Services: (Please be general)</td>
<td><textarea name="D_Commodities" cols="37" rows="7"></textarea></td>
</tr>
<tr>
<td><input type="hidden" name="hidDate"></td>
</tr>
</table>
<table BORDER=0 CELLSPACING=5 CELLPADDING=5 WIDTH="60%" >
<tr>
<td><center><input type="submit" name="Submit" value="Register"></center></td>
<td><input type="reset" name="Reset" value="Reset"></td>
</tr>
</table>
</form>
</table
</body>
</html>
Code for addsupplier.asp is as follows:
<%
Option Explicit
'Declare variables
Dim strCompany
Dim strAddress
Dim strCity
Dim strState
Dim strZip
Dim strPhone
Dim strFax
Dim strWebsite
Dim strContact
Dim strCPhone
Dim strEmail
Dim strCommodities
Dim strhidDate
Dim SQLINSERT
Dim connupdate
'Grab variables from the querystring.
strCompany=Request.Form("D_Company")
strAddress=Request.Form("D_Address")
strCity=Request.Form("D_City")
strState=Request.Form("D_State")
strZip=Request.Form("D_Zip")
strPhone=Request.Form("D_Phone")
strFax=Request.Form("D_Fax")
strWebsite=Request.Form("D_Website")
strContact=Request.Form("D_Contact")
strCPhone=Request.Form("D_CPhone")
strEmail=Request.Form("D_Email")
strCommodities=Request.Form("D_Commodities")
strhidDate=Request.Form("hidDate")
SQLINSERT = "INSERT INTO WebSupplier(Company_Name, St_Address, City, State, Zip, Phone_Num, Fax_Num, Web_Site, Contact_Person, Contact_Phone, Contact_Email, Commodities, Respond_Da) Values('" & replace(strCompany, "'", "") & "', '" & replace(strAddress, "'", "") & "', '" & replace(strCity, "'", "") & "', '" & strState & "', '" & strZip & "', '" & strPhone & "', '" & strFax & "', '" & replace(strWebsite, "'", "") & "', '" & replace(strContact, "'", "") & "', '" & strCPhone & "', '" & replace(strEmail, "'", "") & "', '" & replace(strCommodities, "'", "") & "', '" & strhidDate & "')"
set connupdate = server.createobject("ADODB.Connection")
connupdate.open "Register"
connupdate.execute(SQLINSERT)
connupdate.close
set connupdate = nothing
%>
<html>
<head>
<title>Registration Thank You Page</title>
</head>
<body>
<center><table BORDER=0 CELLSPACING=2 CELLPADDING=2 COLS=1 WIDTH="97%" >
<tr>
<td><center>REGISTRATION COMPLETED</center>
<center><b>
<% Response.Write(strCompany) %>
<% Response.Write "<br>" %>
<% Response.Write "Thank you for registering!" %> </b></center>
<br><center>
<% Response.Write "You have now been added to the Registration Database. If a product or service is needed you will be contacted. We appreciate your time and effort in completing the Registration Form." %>
<p>
<% Response.Write "Thank you!" %> </center>
</td>
</tr>
</table></center>
</body>
</html>
I didn't add the email code to keep it short. Any help would be appreciated. Thanks a million!!