radio buttons in html

2 replies [Last post]
Last seen: 1 year 31 weeks ago
Joined: 2009-02-18
bOt Points: 1160
Hello roopalisaxena2, Yes you

Hello roopalisaxena2,

Yes you can pass multiple values for a single radio button. Check out the following example -

<input type="radio" name="choice" value="apple banana orange"/>

The different values have been separated by a space. You can also use a different separator.

While submitting this form use the following PHP code (on the next page) to extract all the values -

list($fruit1, $fruit2, $fruit3) = explode(" ", $POST["choice"]);

So your variables $fruit1, $fruit2 and $fruit3 will now contain the different values of the radio button.

If you use a different separator just change the explode function accordingly for example -

<input type="radio" name="choice" value="apple|banana|orange"/> 

list($fruit1, $fruit2, $fruit3) = explode("|", $POST["choice"]);

Founder and Admin

Last seen: 10 years 20 weeks ago
Joined: 2009-11-15
bOt Points: 58
thank u so

thank u so much................ this has solved a major problem which me n my friend have been brainstorming about

thanks a ton...........