%@ LANGUAGE = "VBScript" %>
<% Response.Buffer = false %>
<%
Dim bErrorsOnPage
Dim dblQuote, willAttend, numberOfPeople, surname, firstname, email, message
Dim posDelimiter
Dim bSurnameError, sFirstnameError
dblQuote = Chr(34)
bErrorsOnPage = False
'***************************************************************************************
surname= request.Form("surname")
If IsEmpty(surname) Or IsNull(surname) Or surname= "" Then
bErrorsOnPage = True
bSurnameError = True
Session("surnameError") = "
* surname not entered"
End If
firstname= request.Form("firstname")
If IsEmpty(firstname) Or IsNull(firstname) Or firstname= "" Then
bErrorsOnPage = True
bFirstnameError = True
Session("firstnameError") = "
* firstname not entered"
End If
numberOfPeople= request.Form("numberOfPeople")
If IsEmpty(numberOfPeople) Or IsNull(numberOfPeople) Or numberOfPeople= "" Then
bErrorsOnPage = True
bnumberOfPeopleError = True
Session("numberOfPeopleError") = "
* please enter a number"
Else
If Not IsNumeric(numberOfPeople) Then
bErrorsOnPage = True
bnumberOfPeopleError = True
Session("numberOfPeopleError") = "
* must be a number - eg. enter 1, not One"
End If
End If
willAttend = request.Form("willAttend")
If CInt(willAttend) = 1 Then
Session("willAttendYes") = "checked"
Session("willAttendNo") = ""
willAttend = "Yes"
Else
Session("willAttendYes") = ""
Session("willAttendNo") = "checked"
willAttend = "No"
End If
email = request.Form("email")
message = request.Form("message")
Session("numberOfPeople") = numberOfPeople
Session("firstname") = firstname
Session("surname") = surname
Session("email") = email
Session("message") = message
If bErrorsOnPage = True Then
Session("submitResults") = "
* Please correct input errors and submit again"
Else
Dim currTimestamp
currTimestamp = monthname(month(now)) & "-" & day(now) & "-" & year(now) & " " & time
strSQL ="Delete from tblRSVP WHERE "
strSQL = strSQL & " firstname=" & Chr(34) & Trim(firstname) & Chr(34)
strSQL = strSQL & " And surname=" & Chr(34) & Trim(surname) & Chr(34)
On Error Resume Next
con.Execute strSQL
If err.number > 0 then
If CStr(err.nativeerror) = "2013" or CInt(err.nativeerror) = 2013 Then
con.Close
Set con=nothing
%>
<%
Else
response.write "VBScript Errors Occured:" & "
" response.write "Error Number=" & err.number & "
" response.write "Error Descr.=" & err.description & "
" response.write "Help Context=" & err.helpcontext & "
" response.write "Help Path=" & err.helppath & "
" response.write "Native Error=" & err.nativeerror & "
" response.write "Source=" & err.source & "
" response.write "SQLState=" & err.sqlstate & "
" con.Close Set con=nothing End If Else strSQL ="Insert into tblRSVP " strSQL = strSQL & "(surname, firstname, email, numberOfPeople, willAttend, message, dateReply) " strSQL = strSQL & "values (" strSQL = strSQL & Chr(34) & Trim(surname) & Chr(34) & "," strSQL = strSQL & Chr(34) & Trim(firstname) & Chr(34) & "," strSQL = strSQL & Chr(34) & email & Chr(34) & "," strSQL = strSQL & numberOfPeople & "," strSQL = strSQL & Chr(34) & willAttend & Chr(34) & "," strSQL = strSQL & Chr(34) & Replace(message,Chr(34),"'") & Chr(34) & "," strSQL = strSQL & Chr(34) & currTimestamp & Chr(34) & ")" con.Execute strSQL If err.number > 0 then If CStr(err.nativeerror) = "2013" or CInt(err.nativeerror) = 2013 Then con.Close Set con=nothing %> <% Else response.write "VBScript Errors Occured:" & "
" response.write "Error Number=" & err.number & "
" response.write "Error Descr.=" & err.description & "
" response.write "Help Context=" & err.helpcontext & "
" response.write "Help Path=" & err.helppath & "
" response.write "Native Error=" & err.nativeerror & "
" response.write "Source=" & err.source & "
" response.write "SQLState=" & err.sqlstate & "
"
con.Close
Set con=nothing
End If
Else
Session("submitResults") = "
Thank you. Your RSVP has been forwarded to Marie-Josee and Mike!"
con.Close
Set con=nothing
End If
End If
End If
%>