Question about forms

Discussion in 'HTML' started by tracy.cooperjr@gmail.com, Jun 10, 2006.

  1. Guest

    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.
     
    , Jun 10, 2006
    #1
    1. Advertising

  2. Martin Jay Guest

    In message <>,
    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
    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
     
    Martin Jay, Jun 10, 2006
    #2
    1. Advertising

  3. Martin Jay <> 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
    > if name = 2 then email form to
    > if name = 3 then email form to


    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/
     
    Jukka K. Korpela, Jun 10, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brendan Miller

    Web Forms VS Windows Forms

    Brendan Miller, Aug 11, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    5,103
    Kevin Spencer
    Aug 11, 2003
  2. Eric
    Replies:
    2
    Views:
    1,509
    Tommy
    Feb 13, 2004
  3. jlopes151
    Replies:
    2
    Views:
    655
    Steve C. Orr [MVP, MCSD]
    Mar 14, 2005
  4. =?Utf-8?B?ZGF2aWQ=?=

    embedded windows forms into web forms for control

    =?Utf-8?B?ZGF2aWQ=?=, Apr 7, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    5,228
    =?Utf-8?B?ZGF2aWQ=?=
    Apr 10, 2005
  5. Eric
    Replies:
    2
    Views:
    578
Loading...

Share This Page