Check For !isset for multiple check boxes fields

Hello,

What I would like to do is simply check to make sure one of two check boxes are checked.

My current code is

[php]if(!isset($c1,$c2)){
$checkBoxError=‘Please Check One’;
}[/php]

This results in if either of them are unchecked the error message is created. I have also tired

[php]if(!isset($c1) && !isset($c2)){
$checkBoxError=‘Please Check One’;
}[/php]

This results in an error that $checkBoxError is undefined even when no check boxes are checked… Any help would be appreciated…

Thank you.

Okay, figured it out. I just had to use

[php]if(!isset($_POST[‘cc’]) && !isset($_POST[‘decline’])){
$checkBoxError=‘Please Check One’;
}[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service