Click to See Complete Forum and Search --> : a question on CDO asp email script getting fieldss


damon2003
05-10-2005, 06:39 AM
Hi,

I have several asp forms that to an asp email script. I want to know if it is possible to send this form to the script, but instead of having to specify every form field in the form, is it possible to just have a simple script that will send all the form fields as an email. This would be better because there are several forma, each with different fields, it would be good to use one generic script,

thanks a lot for any advice

buntine
05-10-2005, 10:59 AM
Use the For Each loop.

Dim strBody: strBody = "Email form contents:<br /><br />"

For Each frmObject In Request.Form
strBody = strBody & frmObject & ": " & Request.Form(frmObject) & "<br />"
Next

Try that. It should loop through each form field and append its name and value to the strBody variable, which can be assigned as the body of the email.

To see it on the page (for debugging purposes), use this:

Response.Write(strBody)

Regards.