Use of radio buttons on forms

M

maurice

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 (e-mail address removed) otherwise it is set to (e-mail address removed) - or
does it HAVE to be done as part of the CGI script?
 
D

David Dorward

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?

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

Toby Inkster

maurice said:
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 (e-mail address removed) otherwise it is set to (e-mail address removed) - or
does it HAVE to be done as part of the CGI script?

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="(e-mail address removed)">

Change it to:

<div>
<b>Recipient:</b>
<ul>
<li><label><input type="checkbox" name="recipient"
value="(e-mail address removed)"> Secretary</label>
<li><label><input type="checkbox" name="recipient"
value="(e-mail address removed)"> 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.
 
A

Alan J. Flavell

<li><label><input type="checkbox" name="recipient"
value="(e-mail address removed)"> Secretary</label>
<li><label><input type="checkbox" name="recipient"
value="(e-mail address removed)"> Chairman</label>

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.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top