Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Nov 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Send Radio Button Form Results to Two Email Addresses...

    How would one build a form with the following criteria:

    1.) Two radio buttons (Subscribe) and (Unsubscribe)
    2.) A text box to enter an email address
    3.) Submit button which will send all (Subscribe) requests to one email address and all (Unsubscribe) requests to another email address

    Any input would be greatly appreciated!

    Nina

  • #2
    Regular Coder
    Join Date
    Nov 2002
    Location
    Manchester, UK
    Posts
    533
    Thanks
    4
    Thanked 1 Time in 1 Post
    assuming you are using an ASP, or PHP (or similar) language to post the data to, I would do something like this: (using PHP in this case)

    Code:
    <script type="text/javascript">
    function decide(what) {
    	document.formname.todo.value = what;
    	document.formname.submit();
    }
    </script>
    
    <form name="formname" method="post" action="">
    <input type="hidden" name="todo">
      <p>Email Address: <input type="text" name="email"></p>
      <p>
        <input type="button" value="Subscribe" onclick="decide('subscribe')">
        <input type="button" value="Unsubscribe" onclick="decide('unsubscribe')">
      </p>
    </form>
    Once the user presses on of the buttons, they will populate the hidden form tag called "todo". You can then do something on the next page which would sub or unsubscribe them.

    Hope that helps

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,048
    Thanks
    0
    Thanked 251 Times in 247 Posts
    Code:
    <form name="formname" method="post" action="">
      <p>Email Address: <input type="text" name="email"></p>
      <p>
        <input type="submit" name="btnSubscribe" value="Subscribe" />
        <input type="submit" name="btnUnsubscribe" value="Unsubscribe" />
      </p>
    </form>
    Then in the server-side code, check which button is clicked by looking at the value of btnSubscribe and btnUnSubscribe form data. Only the one clicked will be submitted to the server.

  • #4
    New to the CF scene
    Join Date
    Nov 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by homerUK
    assuming you are using an ASP, or PHP (or similar) language to post the data to, I would do something like this: (using PHP in this case)

    Code:
    <script type="text/javascript">
    function decide(what) {
    	document.formname.todo.value = what;
    	document.formname.submit();
    }
    </script>
    
    <form name="formname" method="post" action="">
    <input type="hidden" name="todo">
      <p>Email Address: <input type="text" name="email"></p>
      <p>
        <input type="button" value="Subscribe" onclick="decide('subscribe')">
        <input type="button" value="Unsubscribe" onclick="decide('unsubscribe')">
      </p>
    </form>
    Once the user presses on of the buttons, they will populate the hidden form tag called "todo". You can then do something on the next page which would sub or unsubscribe them.

    Hope that helps

    I should have told you that I was extremely in the dark on this one. I have built my site solely on asking questions and reading, reading, and reading.

    I know little to nothing about ASP or PHP. I have a hosting company with the email through them, accessed via OE6.

    Any additional information/assistance would be greatly appreciated!

    Thanks again,
    Nina


  •  

    Posting Permissions

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