%
If Request.Form("button") = "Submit" Then
'=============================================
'= RETRIEVE VALUES FROM RSVP FORM SUBMISSION =
'=============================================
sh_type = CompareInput(SQLise(Request.Form("frm_shoot_type")))
sh_cl_email = CompareInput(SQLise(Request.Form("frm_cl_email")))
sh_par_email = CompareInput(SQLise(Request.Form("frm_par_email")))
sh_terms = CompareInput(SQLise(Request.Form("frm_terms")))
sh_cl_name = CompareInput(SQLise(Request.Form("frm_cl_name")))
sh_loc = CompareInput(SQLise(Request.Form("frm_location")))
sh_desc = CompareInput(SQLise(Request.Form("frm_desc")))
sh_date = CompareInput(SQLise(Request.Form("frm_shoot_date")))
sh_cl_dob_d = CompareInput(SQLise(Request.Form("frm_cl_dob_d")))
sh_cl_dob_m = CompareInput(SQLise(Request.Form("frm_cl_dob_m")))
sh_cl_dob_y = CompareInput(SQLise(Request.Form("frm_cl_dob_y")))
sh_cl_cell = CompareInput(SQLise(Request.Form("frm_cl_cell")))
sh_cl_email2 = CompareInput(SQLise(Request.Form("frm_cl_email2")))
sh_terms2 = CompareInput(SQLise(Request.Form("frm_terms2")))
sh_sign = CompareInput(SQLise(Request.Form("frm_sign")))
sh_18older = CompareInput(SQLise(Request.Form("frm_18older")))
sErrors = ""
'=============================================================
'== SERVER SIDE VALIDATION ==
'=============================================================
If Trim(sh_type) = "" Then
sErrors = "Please indicate the type of Photo Shoot Type!
"
End If
If Trim(sh_cl_email) = "" Then
sErrors = sErrors & "Please complete the Client Email Address Field!
"
Else
If NOT validateEmail(sh_cl_email) Then
sErrors = sErrors & "Please enter a valid Client Email Address!
"
End If
End If
If Trim(sh_par_email) = "" Then
sErrors = sErrors & "Please complete the Parent Email Address Field!
"
Else
If NOT validateEmail(sh_par_email) Then
sErrors = sErrors & "Please enter a valid Parent Email Address!
"
End If
End If
If Trim(sh_terms) = "" Then
sErrors = sErrors & "You must accept the terms and conditions!
"
End If
If Trim(sh_cl_name) = "" Then
sErrors = sErrors & "Please complete The Client Name Field!
"
End If
If Trim(sh_cl_cell) = "" Then
sErrors = sErrors & "Please complete The Client Mobile Phone Number Field!
"
End If
If Trim(sh_cl_email2) = "" Then
sErrors = sErrors & "Please complete the Client Email Address Field!
"
Else
If NOT validateEmail(sh_cl_email2) Then
sErrors = sErrors & "Please enter a valid Client Email Address!
"
End If
End If
If Trim(sh_terms2) = "" Then
sErrors = sErrors & "You must accept the terms and conditions!
"
End If
If Trim(sh_sign) = "" Then
sErrors = sErrors & "You must sign the form!
"
End If
'=============================================================
'= DATABASE INSERT OF VALUES =
'=============================================================
If Len(sErrors) = 0 Then
If sh_18older = "" OR isNull(sh_18older) Then
sh_18older = 2
End If
sh_cl_dob = sh_cl_dob_d & "/" & sh_cl_dob_m & "/" & sh_cl_dob_y
sInsertSQL = ""
sInsertSQL = "INSERT INTO tbl_book "
sInsertSQL = sInsertSQL & "(fld_sh_type, "
sInsertSQL = sInsertSQL & " fld_sh_cl_email, "
sInsertSQL = sInsertSQL & " fld_sh_par_email, "
sInsertSQL = sInsertSQL & " fld_sh_terms, "
sInsertSQL = sInsertSQL & " fld_sh_cl_name, "
sInsertSQL = sInsertSQL & " fld_sh_loc, "
sInsertSQL = sInsertSQL & " fld_sh_desc, "
sInsertSQL = sInsertSQL & " fld_sh_date, "
sInsertSQL = sInsertSQL & " fld_sh_cl_dob, "
sInsertSQL = sInsertSQL & " fld_sh_cl_cell, "
sInsertSQL = sInsertSQL & " fld_sh_cl_email2, "
sInsertSQL = sInsertSQL & " fld_sh_terms2, "
sInsertSQL = sInsertSQL & " fld_sh_sign, "
sInsertSQL = sInsertSQL & " fld_sh_18older, "
sInsertSQL = sInsertSQL & " fld_sh_date_sub) "
sInsertSQL = sInsertSQL & " VALUES "
sInsertSQL = sInsertSQL & "("&sh_type&", "
sInsertSQL = sInsertSQL & " '"&sh_cl_email&"', "
sInsertSQL = sInsertSQL & " '"&sh_par_email&"', "
sInsertSQL = sInsertSQL & " "&sh_terms&", "
sInsertSQL = sInsertSQL & " '"&sh_cl_name&"', "
sInsertSQL = sInsertSQL & " '"&sh_loc&"', "
sInsertSQL = sInsertSQL & " '"&sh_desc&"', "
sInsertSQL = sInsertSQL & " '"&sh_date&"', "
sInsertSQL = sInsertSQL & " '"&sh_cl_dob&"', "
sInsertSQL = sInsertSQL & " '"&sh_cl_cell&"', "
sInsertSQL = sInsertSQL & " '"&sh_cl_email2&"', "
sInsertSQL = sInsertSQL & " "&sh_terms2&", "
sInsertSQL = sInsertSQL & " "&sh_sign&", "
sInsertSQL = sInsertSQL & " "&sh_18older&", "
sInsertSQL = sInsertSQL & " '"&universalDate(Date())&"') "
'
'Response.Write(sInsertSQL)
'Response.End
openConn1()
Set oInsertRS = oConn.Execute(sInsertSQL, iRowsAffected)
Set oInsertRS = Nothing
sInsertSQL = ""
sInsertSQL = "SELECT @@IDENTITY"
Set oInsertRS = oConn.Execute(sInsertSQL)
If NOT oInsertRS.BOF AND NOT oInsertRS.EOF Then
sh_id = oInsertRS(0)
End If
Set oInsertRS = Nothing
sInsertSQL = ""
closeConn()
'Mail To Be Sent
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.OpenTextFile(Server.MapPath("bookmail.htm"), 1)
thebody = f.ReadAll
sSubject = "Online Photo Shoot Booking"
theurl = "thankyou.asp?sh_id=" & sh_id
fFrom = "info@human2water.co.za"
Set oMail = Server.CreateObject("JMail.Message")
oMail.Silent = True
oMail.Logging = True
oMail.ReplyTo = fFrom
oMail.From = fFrom
oMail.Subject = sSubject
oMail.AddRecipient "human2water@gmail.com"
oMail.AddRecipient "dru@thatsitcom.co.za"
oMail.ContentType = "text/html"
oMail.HTMLBody = thebody
If NOT oMail.Send("localhost") Then
Response.Write ("Your confirmation was not sent due to an error. Please try again later")
Else
Response.Redirect(theurl)
End If
End If
End If
%>