Quote:
Originally Posted by GazMathias
You might want to fix this, for one:
-
value="%=inputArray(4,2)%>"
-
Though as far as I know, select elements don't have a value attribute, as they are catered for by option elements.
Can we also see how you are parsing this data?
Gaz
Below is the ASP I'm using.....appreciate 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.Count > 0 THEN
execute("const numberOfFields =" & request.Form.Count)
execute("redim inputArray("&numberOfFields&",2)")
FOR i = 1 TO request.Form.Count
inputArray(i,1) = request.Form.Key(i)
inputArray(i,2) = request.Form.Item(i)
NEXT
validate
ELSEIF request.QueryString.Count > 0 THEN
execute("const numberOfFields =" & request.QueryString.Count)
execute("redim inputArray("&numberOfFields&",2)")
FOR i = 1 TO request.QueryString.Count
inputArray(i,1) = request.QueryString.Key(i)
inputArray(i,2) = request.QueryString.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(exceptions)
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=inputArray(i,1) THEN
validationResult = validateEmail(inputArray(i,2))
IF validationResult <> "" THEN
errorMessage = validationResult
badItem = i
END IF
END IF
NEXT
END SUB
FUNCTION validateEmail(strAddress)
IF InStr(strAddress,"@") < 2 THEN
validateEmail = "Email address must contain ""@"" sign."
ELSEIF InStr(Right(strAddress,Len(strAddress)-InStr(strAddress,"@")),".") < 2 OR InStr(Right(strAddress,Len(strAddress)-InStr(strAddress,"@")),".") = Len(strAddress)-InStr(strAddress,"@") THEN
validateEmail = "Email address must contain ""."" sign."
END IF
END FUNCTION
%>
<p> </p>
<%
IF errorMessage<>"" THEN
%>
<p class="errorMessage">There was an error with your form: <b><%=errorMessage%></b></p>
<%
ELSEIF request.form.count = 0 AND request.form.count = 0 THEN
%>
<%
ELSE
EmailFrom = "kip1790@hotmail.com"
EmailTo = "kip1790@hotmail.com"
Subject = "Google Membership Request"
fname = Trim(Request.Form("fname"))
lname = Trim(Request.Form("lname"))
email = Trim(Request.Form("email"))
location = Trim(Request.Form("location"))
goal = Trim(Request.Form("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.CreateObject("CDONTS.NewMail")
mail.To = EmailTo
mail.From = EmailFrom
mail.Subject = Subject
mail.Body = Body
mail.Send
%>
<font class="body">Thank you, we will be in touch shortly.<p> </p><a href="http://www.totum.ca/">Click here to be directed to our website... </a></font>
<%
response.End
END IF
%>