0

How to make two separated group of radiobutton when making a form?

for example, class: vvip or vip gender: male or female

1st Feb 2017, 6:18 PM
prayoga
prayoga - avatar
3 Answers
+ 10
<input type="radio" name="gender" value="male" checked> Male<br> <input type="radio" name="gender" value="female"> Female<br> <input type="radio" name="class" value="vip" checked>vip<br> <input type="radio" name="class" value="vvip">vvip
1st Feb 2017, 6:27 PM
Valen.H. ~
Valen.H. ~ - avatar
0
Use name attribute for grouping the radio buttons Example : <form>   <input type="radio" name="gender" value="male" checked> Male<br>   <input type="radio" name="gender" value="female"> Female<br>   <input type="radio" name="gender" value="other"> Other </form>
1st Feb 2017, 6:24 PM
Alex Soh Chye Wat
Alex Soh Chye Wat - avatar
0
A "group" of radio buttons is defined because they have the same "name". You can put as many radio buttons you want in your "form". You just have to define your different groups by giving the same "name" to the button you want in the same group. ValentinHacker gave a good example: <input type="radio" name="gender" value="male" checked> Male<br> <input type="radio" name="gender" value="female"> Female<br> <input type="radio" name="class" value="vip" checked>vip<br> <input type="radio" name="class" value="vvip">vvip The two first button will form the first group because they both have name="gender" and the last two will form another group because their name="class".
2nd Feb 2017, 1:07 PM
Cyril NICARD