<% If request("txtSubmit") = "Submit" Then 'call InsertGuestbook Else End If %>

"> Welcome to our guestbook.

Please fill out the information below and press Submit to add to the guestbook.
To view the guestbook, click here.
Name:
Email:
URL:
City:
State:
Comments:

>

<% Sub InsertGuestbook Dim Lname Dim Lemail Dim Lurl Dim Lcity Dim Lstate Dim Lcomments Dim xAddr Dim xHost xAddr=request.ServerVariables("REMOTE_ADDR") xHost=request.ServerVariables("REMOTE_HOST") name = Request("txtName") email = Request("txtEmail") url = Request("txtURL") city = Request("txtCity") state = Request("txtState") comments = Request("txtComments") Lname = Len(Trim(name)) comments = Replace(comments, Chr(39), "") comments = Replace(comments, Chr(34), "") Set objConn = CreateObject("ADODB.Connection") ConnectionString = "DSN=WollardGuestbook;" & _ "Driver={Microsoft Access Driver (*.mdb)};" & _ "Uid=Admin;" & _ "Pwd=;" objConn.Open ConnectionString If Lname > 0 Then strSQL = "Insert into guestbook(" & _ "name," & _ "email," & _ "url," & _ "city," & _ "state," & _ "comments," & _ "addr," & _ "host)" & _ " Values (" & _ "'" & name & "'," & _ "'" & email & "'," & _ "'" & url & "'," & _ "'" & city & "'," & _ "'" & state & "'," & _ "'" & comments & "'," & _ "'" & xAddr & "'," & _ "'" & xHost & "');" objConn.Execute strSQL objConn.close End If Set objConn = Nothing Response.Write "
The following Information has been added to the guestbook:

" Response.Write "Name: " & Request("txtName") & "
" Response.Write "Email: " & Request("txtEmail") & "
" Response.Write "URL: " & Request("txtURL") & "
" Response.Write "City: " & Request("txtCity") & "
" Response.Write "State: " & Request("txtState") & "
" Response.Write "Comments: " & Request("txtComments") & "

" Response.Write "View Guestbook
" End Sub %>