0

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";
}

It doesn't work. Also, how could I do it with radiobutton?

Edited by AngelicOne: n/a

2
Contributors
2
Replies
5
Views
6 Years
Discussion Span
Last Post by AngelicOne
0

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!

Edited by AngelicOne: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.