Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 30th, 2005, 12:15 AM   #1
Ashok
Newbie
 
Join Date: May 2005
Posts: 8
Rep Power: 0 Ashok is on a distinguished road
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.
Ashok is offline   Reply With Quote
Old Jul 10th, 2005, 2:28 PM   #2
PhillipH
Newbie
 
Join Date: Jul 2005
Posts: 9
Rep Power: 0 PhillipH is on a distinguished road
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.
__________________
Phillip Harrison
http://www.onestop-webdesign.com
PhillipH is offline   Reply With Quote
Old Jul 10th, 2005, 2: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
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:34 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC