Hi All,
I have recently found a form script that will submit data to an access database and then send the data by email to a designated email address and the administrator (see below). Its pretty damned good but it just doesn't do enough for my purposes.
What I desperately need is to be able to...
Submit data to a database and send an email which would contain the submitted data plus a hypertext link based on the database record just created. This would/should enable the email recipient to click on the link to open a new web page containing more submission fields and so on.
Sounds complicated but I'm sure there must be a way. If you know of any
way to make this posible I would be grateful for any useful suggestions.
I found the script and database at
http://cybercoded.com/Downloads/RFI-Download.asp
<html>
<head>
<meta name="GENERATOR" Content="Microsoft FrontPage 5.0">
<title>Input Form</title>
</head>
<body>
<%
if request.form("Submit")<> "Submit" then
%>
<form action="rfi.asp" method="POST">
<table width="483">
<tr>
<td align="right" width="104">Type of Input</td>
<td width="369"> <select size="1" name="Type" tabindex="1">
<option value="Comment" selected>Comment</option>
<option value="Suggestion">Suggestion</option>
<option value="Question">Question</option>
</select></td>
</tr>
<tr>
<td align="right" width="104">Area</td>
<td width="369"> <select size="1" name="Area" tabindex="2">
<option value="Advertising" selected>Advertising</option>
<option value="Programs">Programs</option>
<option value="Sales">Sales</option>
<option value="Support">Support</option>
<option value="Web Site">Web Site</option>
</select></td>
</tr>
<tr>
<td align="right" width="104">First Name</td>
<td width="369">
<input name="FirstName" type="text" size="20" tabindex="3"></td>
</tr>
<tr>
<td align="right" width="104">Last Name</td>
<td width="369">
<input name="LastName" type="text" size="20" tabindex="4"></td>
</tr>
<tr>
<td align="right" width="104">email address</td>
<td width="369">
<input name="email" type="text" size="50" tabindex="5"></td>
</tr>
<tr>
<td align="right" valign="top" width="104">Comments</td>
<td width="369">
<textarea rows="5" name="Comments" cols="42" tabindex="7"></textarea></td>
</tr>
<tr>
<td align="right" width="104"><input name="Submit" type=submit value="Submit"></td>
<td width="369"><input name="reset" type=reset value="Reset"></td>
</tr>
</table>
</form>
<%
else
strType=Request.form("Type")
strArea=Request.form("Area")
strFirstName=Request.form("FirstName")
strLastName=Request.form("LastName")
stremail=Request.form("email")
strDate=Date
strID=ID
strComments=Request.form("Comments")
Set objConn = Server.CreateObject("ADODB.Connection")
ConnectionString="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("comments.mdb")
objConn.Open ConnectionString
sqlQuery = "SELECT * FROM Comments"
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open sqlQuery, objConn, 1, 2
objRS.AddNew
objRS("Type")=strType
objRS("Area")=strArea
objRS("FirstName")=strFirstName
objRS("LastName")=strLastName
objRS("email")=stremail
objRS("SubmitDate")=strDate
objRS("comments")=strcomments
objRS.Update
objRS.Close
Set objRS = Nothing
strBody = "ID ------> " & strID & chr(10) & chr(13)
strBody = "Type ------> " & strType & chr(10) & chr(13)
strBody=strBody & "Area ------> " & strArea & chr(10) & chr(13)
strBody=strBody & "Name ------> " & strFirstName & " " & strLastName & chr(10) & chr(13)
strBody=strBody & "email -----> " & stremail & chr(10) & chr(13)
strBody=strBody & "Comments --> " & strComments & chr(10) & chr(13)
strBody=strBody & "Date ------> " & strDate & chr(10) & chr(13)
strBody=strBody & "--------------- " & chr(10) & chr(13)
Dim objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail")
objCDO.From = "you@yoursite.co.uk"
objCDO.To = "you@yoursite.co.uk"
objCDO.Subject = "Feedback Form"
objCDO.Body = strBody
objCDO.BodyFormat = 1
objCDO.MailFormat = 1
objCDO.Send
Set objCDO = Server.CreateObject("CDONTS.NewMail")
objCDO.From = "you@yoursite.co.uk"
objCDO.To = stremail
objCDO.Subject = "Feedback Form"
objCDO.Body = strBody
objCDO.BodyFormat = 1
objCDO.MailFormat = 1
objCDO.Send
Response.Write "Record Added Succesfully<BR><BR>"
Response.Write strFirstName & " " & strLastName
Response.Write ", Thanks for the " & strType
Response.Write " about our " & strArea
end if
%>
</body>
</html>