@GazMathias
Below is the ASP I'm using.....appre ciate the prompt response.I need to know how to populate the array with the option selected.....
<%
'============== =============== ====
'All fields are acted as required
' except those the NAME of which
' is in this string variable:
'============== =============== ====
exceptions = Array("address" )
'============== =============== ====
'NAME of the e-mail field is
' stored in this string variable:
'============== =============== ====
emailField = "email"
'============== =============== ====
'Variables
'============== =============== ====
Dim EmailFrom
Dim EmailTo
Dim Subject
Dim fname
Dim lname
Dim email
Dim location
Dim goal
dim errorMessage, badItem, inputArray() : badItem=-1
redim inputArray(50,4 )
'============== =============== ====
'Get all what is submitted
'============== =============== ====
IF request.Form.Co unt > 0 THEN
execute("const numberOfFields =" & request.Form.Co unt)
execute("redim inputArray("&nu mberOfFields&", 2)")
FOR i = 1 TO request.Form.Co unt
inputArray(i,1) = request.Form.Ke y(i)
inputArray(i,2) = request.Form.It em(i)
NEXT
validate
ELSEIF request.QuerySt ring.Count > 0 THEN
execute("const numberOfFields =" & request.QuerySt ring.Count)
execute("redim inputArray("&nu mberOfFields&", 2)")
FOR i = 1 TO request.QuerySt ring.Count
inputArray(i,1) = request.QuerySt ring.Key(i)
inputArray(i,2) = request.QuerySt ring.Item(i)
NEXT
validate
END IF
SUB validate
'============== =============== ====
'Check for empty fields
'============== =============== ====
FOR i = 1 TO numberOfFields
isException = False
IF inputArray(i,2) ="" THEN
FOR j = 0 to UBound(exceptio ns)
IF inputArray(i,1) = exceptions(j) THEN isException = TRUE
NEXT
IF NOT isException THEN
badItem = i
errorMessage = "At least one of the required fields is left empty."
EXIT SUB
END IF
END IF
isException = False
NEXT
'============== =============== ====
'Check email address for basic
' errors
'============== =============== ====
FOR i = 1 TO numberOfFields
IF emailField=inpu tArray(i,1) THEN
validationResul t = validateEmail(i nputArray(i,2))
IF validationResul t <> "" THEN
errorMessage = validationResul t
badItem = i
END IF
END IF
NEXT
END SUB
FUNCTION validateEmail(s trAddress)
IF InStr(strAddres s,"@") < 2 THEN
validateEmail = "Email address must contain ""@"" sign."
ELSEIF InStr(Right(str Address,Len(str Address)-InStr(strAddres s,"@")),".") < 2 OR InStr(Right(str Address,Len(str Address)-InStr(strAddres s,"@")),".") = Len(strAddress)-InStr(strAddres s,"@") THEN
validateEmail = "Email address must contain ""."" sign."
END IF
END FUNCTION
%>
<p> </p>
<%
IF errorMessage<>" " THEN
%>
<p class="errorMes sage">There was an error with your form: <b><%=errorMess age%></b></p>
<%
ELSEIF request.form.co unt = 0 AND request.form.co unt = 0 THEN
%>
<%
ELSE
EmailFrom = "kip1790@hotmai l.com"
EmailTo = "kip1790@hotmai l.com"
Subject = "Google Membership Request"
fname = Trim(Request.Fo rm("fname"))
lname = Trim(Request.Fo rm("lname"))
email = Trim(Request.Fo rm("email"))
location = Trim(Request.Fo rm("location") )
goal = Trim(Request.Fo rm("goal"))
Dim Body
Body = Body & "First Name: " & fname & VbCrLf
Body = Body & "Last Name: " & lname & VbCrLf
Body = Body & "Email: " & email & VbCrLf
Body = Body & "Location: " & location & VbCrLf
Body = Body & "Primary Fitness Goal: " & goal & VbCrLf
' send email
Dim mail
Set mail = Server.CreateOb ject("CDONTS.Ne wMail")
mail.To = EmailTo
mail.From = EmailFrom
mail.Subject = Subject
mail.Body = Body
mail.Send
%>
<font class="body">Th ank you, we will be in touch shortly.<p>&nbs p;</p><a href="http://www.totum.ca/">Click here to be directed to our website... </a></font>
<%
response.End
END IF
%>