Why am i able to check more than 1 radio button in this code

html

Solution

Because `name` attribute in radio button must be the same in radio group.

Try this:

<input type="radio" name="somename" value="id_radio"/>ID
<input type="radio" name="somename" value="surname_radio"/>Surname
<input type="radio" name="somename" value="dob_radio"/>DoB

More info at w3c

Problem

``` <body> <form name="search_form" id="search_form" method="POST" action="search_user_data.php"> <table border="1"> <tr> <td colspan="2"> <input type="text" id="search" name="search" /> </td> <td> <input type="submit" value="Search"/> </td> </tr> <tr> <td> <input type="radio" name="id_radio"/>ID </td> <td> <input type="radio" name="surname_radio"/>Surname </td> <td> <input type="radio" name="dob_radio"/>DoB </td> </tr> </table> </form> </body> ```

Original source