Form Validation - Radio Buttons [SOLVED]
Posted: Mon Apr 14, 2008 10:39 am
I've got a llittle problem today.
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.
They are initially uncheck and at least one needs to be selected for the form to be valid.
If tried both following php codes with no luck....
& I've tried this.
Any ideas???
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();
}