In my web page I have placed some radio buttons. But these buttons are not working properly. I can check multiple buttons.
code:
Radio buttons which are grouped together must have the same case-sensitive name
property.
<label for="input1">First Input</label>
<input type="radio" id="input1" name="inputGroup" >
<label for="input2">Second Input</label>
<input type="radio" id="input2" name="inputGroup" >
<label for="input3">Third Input</label>
<input type="radio" id="input3" name="inputGroup" >
JSFiddle demo.
From the HTML specification:
Radio buttons are like checkboxes except that when several share the same control
name
, they are mutually exclusive.
Name them the same way, and in your php or receiving code it will be something like
$_POST['name'] = 'value of selected radio button'