Question about forms

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Is it possible to have a form that can be sent to 1 of 3 different
addresses depending on which selection from a drop-down they have

A user fills out a survey and then can select one of three recipients
of that survey and it will be sent to only that one person and not the
other two as well.

Re: Question about forms writes
Quoted text here. Click to load it

Yes, that's possible.  But it has to be done by a script on your server.

In your HTML form you'd have something like this to create the drop-down

        <select name="email">
                <option value="1">Email address 1</option>
                <option value="2">Email address 2</option>
                <option value="3">Email address 3</option>

And then in the script that receives the form you would use logic such
as like:

        if name = 1 then email form to
        if name = 2 then email form to
        if name = 3 then email form to
Martin Jay
Phone/SMS: +44 7740 191877
Fax: +44 870 915 2124

Re: Question about forms

Quoted text here. Click to load it

Any <select> element (except those with the 'multiple' attribute set) should
have one option preselected, normally a "dummy" option, to avoid getting
browser-dependent default data if the user does not make any selection and
to avoid defaulting to the first option even when you don't mean that.
Therefore, add the following as the first option:

<option value="0" selected>Please select the destination address:</option>

Quoted text here. Click to load it

Well, you would probably want to test "email" (the actual field name) rather
than "name".

In actual programming, you would probably want to use an array or a hash of
addresses and simply pick up an address using "email" as an index to it -
_after_ checking that the value is an integer that is within the specified

And you may wish to check against the case where "email" is none of 1, 2,
and 3. The value 0 should probably be treated gracefully as a user input
error. Other values might be treated as potential cracking attempts, so the
implicit error processing of not doing anything (data ignored, no data sent
anywhere) might be quite adequate.

P.S. I have an uncanny feeling that the OP wanted to do the job without any
kind of server-side scripting. Then the answer is "don't".

Jukka K. Korpela ("Yucca")

Site Timeline