PDA

View Full Version : Forms with arrays



Beginner
06-15-2002, 11:34 PM
Hello,
I use a form that has several list fields, and the selections are populated through arrays.

Is it correct to assume that in order to have the users responses posted back to me, I need to have a database folder in the root or housed with the server?

If so, is there some way of coding the select fields to avoid this?

Thanks for any help. :confused:

JohnKrutsch
06-16-2002, 01:21 AM
As this is the client-side JavaScript forum I will give you the client-side Javascript answer. It is possible to have the form submitted to you using client-side javascript and email. When the form is submitted it sends an email to you with the form data. Often times a popup will warn the user that the information is being submitted by email.

If you do not want to have the info emailed to you in this manner you will have to use a server-side language.

Beginner
06-16-2002, 01:31 AM
Hello John,

I'd be happy to have the form submitted an posted back to me in the manner you mentioned. Are there any tutorials that you know of that would show me how to accomplish having the users choices from select lists that are populated through arrays posted back to me?

Thanks for your response.

JohnKrutsch
06-16-2002, 02:52 PM
Sure, the key is to set up your form tag correctly:

<form method="post" action="mailto:[email protected]" enctype="text/plain">

Of course you would replace all the xxx stuff with the email address you would like to send to. Upon subbmission, the data that was entered into the form and seleceted by the user will be emailed to you.

For a full blown tutorial see:

http://developer.netscape.com:80/viewsource/husted_mailto/mailto.html

whammy
06-18-2002, 01:00 AM
Dang, he beat me to it. I always recommend that tutorial.

P.S. They also have an example javascript formatting method at the bottom of that page; however there IS a problem with that method though regarding Microsoft Outlook/Outlook Express that I ran into if the script or message gets to be too long...

Anyway post back if you run into any problems. If you do, you might find it easier to just post the whole email as John Krutsch suggested:

action="mailto:[email protected]" enctype="text/plain"

in the form tag, instead of the javascript route they have as an example. It's uglier, but it gets the job done.