Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Question about forms

Reply
Thread Tools

Question about forms

 
 
tracy.cooperjr@gmail.com
Guest
Posts: n/a
 
      06-09-2006
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
selected.

Example:
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.

 
Reply With Quote
 
 
 
 
Martin Jay
Guest
Posts: n/a
 
      06-10-2006
In message <(E-Mail Removed) .com>,
http://www.velocityreviews.com/forums/(E-Mail Removed) writes
>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
>selected.
>
>Example:
>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.


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
box:

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

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

if name = 1 then email form to (E-Mail Removed)
if name = 2 then email form to (E-Mail Removed)
if name = 3 then email form to (E-Mail Removed)
--
Martin Jay
Phone/SMS: +44 7740 191877
Fax: +44 870 915 2124
 
Reply With Quote
 
 
 
 
Jukka K. Korpela
Guest
Posts: n/a
 
      06-10-2006
Martin Jay <(E-Mail Removed)> scripsit:

> In your HTML form you'd have something like this to create the
> drop-down box:
>
> <select name="email">
> <option value="1">Email address 1</option>
> <option value="2">Email address 2</option>
> <option value="3">Email address 3</option>
> </select>


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>

> And then in the script that receives the form you would use logic such
> as like:
>
> if name = 1 then email form to (E-Mail Removed)
> if name = 2 then email form to (E-Mail Removed)
> if name = 3 then email form to (E-Mail Removed)


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
bounds.

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")
http://www.cs.tut.fi/~jkorpela/

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
forms authentication -- expired forms cookie vs. not provided forms cookie Eric ASP .Net Security 2 01-27-2006 10:09 PM
embedded windows forms into web forms for control =?Utf-8?B?ZGF2aWQ=?= ASP .Net 2 04-10-2005 01:07 PM
Creating ASP.NET forms, that act like HTML forms jlopes151 ASP .Net 2 03-14-2005 01:01 AM
Forms Authentication question: How to have some pages open and some requiring forms authentication Eric ASP .Net 2 02-13-2004 02:14 PM
Web Forms VS Windows Forms Brendan Miller ASP .Net 2 08-11-2003 09:05 PM



Advertisments