Click here to Skip to main content
15,902,634 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how do i check if a radio button has been selected? I want to be able to post the value of a radio button depending on if it has been selected or not.
Posted

Have a look here:

http://www.homeandlearn.co.uk/php/php4p10.html[^]

Good luck!
 
Share this answer
 
It has been many years since I even looked at any PHP but if I recall correctly, you can just check $_POST["NAME_OF_RADIOBUTTON"]. if the radio button is selected, the value should be present, if it's not selected, the value in $_POST["NAME_OF_RADIOBUTTON"] will be null.
 
Share this answer
 
Comments
[no name] 5-Nov-10 8:23am    
ok so do i just right a conditional statement like this:

if($_post['radiobutton'] == ' ')
{
statements
statments
}
jim lahey 5-Nov-10 10:55am    
the structure looks fine, but I don't think your null check is correct. have a look on php.net for the isset() method

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900