I have a contact form on my site (
http://bigdogcattle.com/?a=Cattle_Contact) that uses a contact.asp.txt file to handle the input. Everything works fine except the required fields. I want an error to be generated what the required fields are not populated, but it isn't working. People can submit without filling any fields in. Any ideas? Here is the code for my contact.asp.txt file:
<%
' Website Contact Form Generator
'
http://www.tele-pro.co.uk/scripts/contact_form/
' This script is free to use as long as you
' retain the credit link
' declare variables
Dim EmailFrom
Dim EmailTo
Dim Subject
Dim Name
Dim Address
Dim Telephone
' get posted data into variables
EmailFrom = Trim(Request.Form("EmailFrom"))
EmailTo = "
[email protected]"
Subject = "Cattle Advertising"
Name = Trim(Request.Form("Name"))
Address = Trim(Request.Form("Address"))
Telephone = Trim(Request.Form("Telephone"))
' validation
Dim validationOK
validationOK=true
If (Trim(Telephone)="") Then validationOK=false
If (Trim(Name)="") Then validationOK=false
If (Trim(Address)="") Then validationOK=false
If (validationOK=false) Then Response.Redirect("error.htm?" & EmailFrom)
' prepare email body text
Dim Body
Body = Body & "Name: " & Name & VbCrLf
Body = Body & "Address: " & Address & VbCrLf
Body = Body & "Telephone: " & Telephone & VbCrLf
' send email
Dim mail
Set mail = Server.CreateObject("CDONTS.NewMail")
mail.To = EmailTo
mail.From = EmailFrom
mail.Subject = Subject
mail.Body = Body
mail.Send
' redirect to success page
Response.Redirect("ok.htm?" & EmailFrom)
%>
Thanks
Jamie