![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: May 2005
Posts: 8
Rep Power: 0
![]() |
Code for ContactUs.asp
I have developed a "ContactUs.asp" page which allows customer to enter few details and when clicked on Submit button the data should get saved in Database. Can anyone send me the code or logic.
|
|
|
|
|
|
#2 |
|
Newbie
Join Date: Jul 2005
Posts: 9
Rep Power: 0
![]() |
code for contact us
you just need to pass the variables from the contact us form to a file that inserts the data into a database.
decide if your going to use an access database, mysql or sql database you need to learn some sql to insert the data into a database. other than that, theres not alot more i can say without giving you the code. |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Jul 2005
Posts: 9
Rep Power: 0
![]() |
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 |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|