Validation of radio button on PHP | SoloLearn: Learn to code for FREE!


Validation of radio button on PHP

i'm trying to validate a radio button so it checks if a radio button has been selected or not

4/8/2017 8:47:57 AM

Suhaila Mohammed

2 Answers

New Answer


for radio button input form, you just get the value by the name of that radio button to check if it checked/selected. Only the checked radio button that will be submited. eg. if you have <input type="radio" id="a3" name="a" value="3"> <input type="radio" id="a4" name="a" value="4"> and the radio button with value="4" you checked, then you submitted, in php (if you using HTTP POST method) you 'll got $_POST['a'] with value "4" cmiiw


@cahya thanks mate worked fine🖒