AngelicOne Posted July 19, 2011 Share Posted July 19, 2011 How could I validate a checkbox and radiobutton input using PHP? I wish to display a message if there's no selected value from checkbox or radiobutton. I tried this for my checkbox. $check = $_POST["checkbox"]; if(empty($check)) { echo "You need to select at least one from the checkboxes"; } But this doesn't work. Link to comment Share on other sites More sharing options...
Ingolme Posted July 19, 2011 Share Posted July 19, 2011 That should work. What result are you getting when you test? Link to comment Share on other sites More sharing options...
AngelicOne Posted July 19, 2011 Author Share Posted July 19, 2011 That should work. What result are you getting when you test?I think it was caused by the isset function around it. It looks to me that I'm double checking it by using the isset function and empty function, that's why it didn't work.I solved it by removing the isset function.Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.