Click to See Complete Forum and Search --> : how to display multiple form fields in email using this script?


ookami
09-30-2004, 10:11 AM
Hello,

I am using this script to submit my form fields into the body of my email:

***********************************************
Dim strBody
dim ix, formElementName, formElementValue

strBody = "Results of form submitted at " & Now() & vbCrLf & CrLf

For ix = 1 to Request.Form.Count

formElementName = Request.Form.Key(ix)
formElementValue = Request.Form.Item(ix)

strBody = strBody & (formElementName & ": " & formElementValue & vbCrLf)
Next

***********************************************

I'm completely new to vbscript and have been searching all over the net for an example of this script being used with mutliple fields with absolutely no luck.

The closest I've come to getting something back from this thing is when I tested the script with these elements:

******************************************************
FormElementName = Request.Form.Key("Name")
formElementValue = Request.Form.Item("Name")
formElementName = Request.Form.Key("Telephone")
formElementValue = Request.Form.Item("Telephone")
formElementName = Request.Form.Key("Email")
formElementValue = Request.Form.Item("Email")
******************************************************

Which produced this result:

Email: Email
Email: Email
Email: Email

Its seems the answer to my problem lies in defining the 'Key' and possibly the 'Item' parameters but I haven't been able to find any documentation on these terms. Can someone out there please save me from what probably is a very simple solution?

Thanks for any and all input!!!

javaNoobie
09-30-2004, 11:52 PM
http://www.asp101.com/articles/hojjat/formvalidation/default.asp