<% response.buffer=true %> <% Set dc = Server.CreateObject("ADODB.Connection") Set rs = Server.CreateObject("ADODB.Recordset") dc.Open "DBQ=" & Server.Mappath("database") & ";Driver={Microsoft Access Driver (*.mdb)};" %> <% openMethod = request.form ("openMethod") if openMethod = "postMessage" then DATE = FormatDateTime(NOW) 'records the post date and time NAME = request.Form ("NAME") EMAIL = request.Form ("EMAIL") CITY = request.Form ("CITY") STATE = request.Form ("STATE") COUNTRY = request.Form ("COUNTRY") SITE = request.Form ("SITE") COMMENTS = request.Form ("COMMENTS") if (NAME = "" or COMMENT = "" or EMAIL = "") then response.write ("NAME, EMAIL and COMMENTS fields must be filled!
") & VBCRLF End IF if CITY = "" then CITY = "nowhere" End If 'CITY ain't a "must_fill" so if it's empty, it's simply replaced with a "nowhere" if len(COMMENTS) > 200 then COMMENTS = Left(COMMENTS, 200) End If MYSQL = "SELECT GUESTBOOK.* FROM GUESTBOOK" 'selects the guestbook table in the database if NOT (NAME = "" or COMMENTS = "" or EMAIL = "") then 'if all fields are valid, adds a record to the DB rs.Open MYSQL, dc, 1, 3 rs.AddNew rs.Fields("DATE") = DATE rs.Fields("NAME") = NAME rs.Fields("EMAIL") = EMAIL rs.Fields("CITY") = CITY rs.Fields("STATE") = STATE rs.Fields("COUNTRY") = COUNTRY rs.Fields("SITE") = SITE rs.Fields("COMMENTS") = COMMENTS rs.Update response.Cookies("server")("name") = NAME response.Cookies("server")("email") = EMAIL response.Cookies("server")("city") = CITY response.Cookies("server")("state") = STATE response.Cookies("server")("country") = COUNTRY response.Cookies("server")("site") = SITE response.Cookies("server").Expires = DateAdd("m",1,Date) End If %> Untitled Document
Site hosted by Angelfire.com: Build your free website today!
  My Guestbook!!

  Name:
  Email:
  City:
  State:
  Country:
  How did you find
this site?
  Comments/Suggestions: