Use of radio buttons on forms

Discussion in 'HTML' started by maurice, Feb 7, 2006.

  1. maurice

    maurice Guest

    I'm happy at passing through the settings of radio buttons as data, but
    is there anyway you can do this within the HTML form

    Two buttons - one marked Secretary the other marked Chairman. Depending
    upon the settings of the buttons the recipient's email address changes?
    For instance, if Secretary is set, the recipient email address is set
    to otherwise it is set to - or
    does it HAVE to be done as part of the CGI script?
     
    maurice, Feb 7, 2006
    #1
    1. Advertisements

  2. Well, you can have the email address as the value of the radio button, but
    you'll then need to take other steps in the server side script so that Joe
    Spammer can't submit whatever email address he wants to send spam to.
     
    David Dorward, Feb 7, 2006
    #2
    1. Advertisements

  3. maurice

    Toby Inkster Guest

    It's a very good idea to do it as part of the CGI script. But...

    Assuming you have something like:

    <input type="hidden" name="recipient" value="">

    Change it to:

    <div>
    <b>Recipient:</b>
    <ul>
    <li><label><input type="checkbox" name="recipient"
    value=""> Secretary</label>
    <li><label><input type="checkbox" name="recipient"
    value=""> Chairman</label>
    </ul>
    </div>

    PS: Please use example.com, example.net or example.org for examples. If
    you use a real domain name (as you have above) it could result in
    unintended consequences for that domain. e.g. someone called Sue who has
    an account at bloggs.com might be getting a load of SPAM because her
    address was posted on Usenet.
     
    Toby Inkster, Feb 7, 2006
    #3
  4. maurice

    maurice Guest

    Thanks for the replies
     
    maurice, Feb 8, 2006
    #4
  5. Just a routine warning that anyone who accepts and uses arbitrary
    email addresses from a form submission has to be barking mad.

    Putting these addresses on view in the HTML page itself (thus exposing
    them to address harvesters) is not exactly a good idea - but that's a
    minor transgression compared with providing an open spamming gateway,
    which is what you appear to be heading for above.

    I'd recommend submitting value="Chairman" etc, from the web page, and
    then looking-up the real address, from a short list of pre-configured
    addresses, *within* the server-side script which processes the
    submission.
     
    Alan J. Flavell, Feb 8, 2006
    #5
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.