View Single Post
Old Jul 10th, 2005, 1:40 PM   #3
PhillipH
Newbie
 
Join Date: Jul 2005
Posts: 9
Rep Power: 0 PhillipH is on a distinguished road
you will obviously have a form for the contact details and then a file that picks up the entered data on submit.

<%

name=request.form("name")
email=request.form("email")
comment=request.form("comment")

%>

then it needs to be entered into the database table. to use a mysql or sql database just use their connection strings instead. database is called textdatabase and table is called contacts

<%
datapath=Server.Mappath("testdatabase.mdb")
strconn="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & datapath & ";"
Set CONN = Server.CreateObject("ADODB.Connection")
CONN.Open strconn
myquery = "INSERT INTO contacts (name,email,comments) VALUES ('" & name & "','" & email & "','" & comments & "')"
conn.execute(myquery)

set conn = nothing
%>

'then redirect to the thank you page
response.redirect "thankyou.html"

the above is fairly basic, i normally add in form validation to check for invalid fields eg empty fields, none numeric or email validation etc
__________________
Phillip Harrison
http://www.onestop-webdesign.com
PhillipH is offline   Reply With Quote