Given the below variables:
$field1;
$field2;
$field3;
$field4;
$field5;
How can I use logical operators so that the user has to fill in either field: 1,2,3 OR either field 1, 2, 4, 5. If user does not do one of the following, then I want to give error required fields not complete.
I have tried:
if ((!$field1 | !$field2 |!$field3) | (!$field1 | !$field2 |!$field4|!$field5))
$errors[] = 'You did not complete all of the required fields.';
1 Answer