SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    junkyrddog's Other Half emmester's Avatar
    Join Date
    Mar 2001
    Posts
    375
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ...that I post this question here.

    This is probably such a newbie question, but how do you set up a form so if one option is selected out of 2 more, the form is sent to that person selected?

  2. #2
    I believe you have my stapler. scrubz's Avatar
    Join Date
    Feb 2001
    Location
    Van down by the river
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Goober was right.

    Try something like this:

    <html>
    <head>
    <title>Send Email</title>

    <script language="JavaScript">
    <!--

    function sendForm() {
    document.myForm.action = 'mailto:' + document.myForm.nameList[document.myForm.nameList.selectedIndex].value
    myForm.submit();
    }

    // -->
    </script>
    </head>

    <body>

    <form name="myForm" method="post" onSubmit="return sendForm();">
    <select name="nameList">
    <option value="mo@mo.com">mo</option>
    <option value="larry@larry.com">larry</option>
    <option value="curly@curly.com">curly</option>
    <input type="submit" name="submit" value="Send Email">
    </form>

    </body>
    </html>

    It uses a select menu, but could just as easily be adapted for radio buttons or whatever else.

  3. #3
    I believe you have my stapler. scrubz's Avatar
    Join Date
    Feb 2001
    Location
    Van down by the river
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Shame on me. I didn't close my <select> tag.

  4. #4
    junkyrddog's Other Half emmester's Avatar
    Join Date
    Mar 2001
    Posts
    375
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks scrubz! Cute avatar.

  5. #5
    I believe you have my stapler. scrubz's Avatar
    Join Date
    Feb 2001
    Location
    Van down by the river
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No problem, emmester. And since you mentioned it, the avatar is actually me at 7 months of age, with a wig on (compliments of my older siblings).


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •