Trying to validate a form radio button.
My form is on the first PHP file, and my validation is done on a 2nd page, and if an error is detected, it goes back to the first page and the error is posted with the help of a few case arguments.
This is the code I have for my radio button.
Code: Select all
<form .....>
<input type="radio" name="comment_pckg" value="Select"> Select<br>
<input type="radio" name="comment_pckg" value="Plus"> Plus<br>
<input type="radio" name="comment_pckg" value="Plus"> Total<br>
</form>If tried both following php codes with no luck....
Code: Select all
if ($_POST["comment_pckg"].unchecked)
{
//redirect back to form
header("Location: ../form.php?error=package_missing");
exit();
}
Code: Select all
if (empty($_POST["comment_pckg"]))
{
//redirect back to form
header("Location: ../form.php?error=package_missing");
exit();
}