I have an IF statement and I need to check two variables, then execute the action if either of the variables are false.
I know I can use the OR (||) statement however for some reason it is not working. I am in the process of learning PHP so it's probably a syntax error on my behalf.
If I create the if statement with only one (either) variable, it works fine:
<?php if ($var1 == false) { do whatever...} ?>
However when I try to check two, neither of the variables seem to be checked. I have tried different syntax variations but nothing works:
<?php if (($var1 == false) || ($var2 == false)) { do whatever...} ?>
<?php if (($var1 == false) OR ($var2 == false)) { do whatever...} ?>
<?php if ($var1 == false || $var2 == false) { do whatever...} ?>
<?php if ($var1 == false OR $var2 == false) { do whatever...} ?>
Can someone please point out what my error is?
Thanks!
EDIT: Including the actual code.
<?php $member = $members_template->member; $bpmember = bp_get_member_user_id(); ?>
<?php $membersearchinclude = xprofile_get_field_data( 'Exclude yourself from website search results?', $bpmember ); ?>
<?php $adminsearchinclude = xprofile_get_field_data( 'Exclude From Search Results', $bpmember ); ?>
<?php if (($adminsearchinclude == false) || ($membersearchinclude == false)) { ?>
This is extracting the xprofile field state from two different checkboxes in BuddyPress. I am checking if either of the checkboxes are false, then executing code.
if elsestatement in theelsepart you could check which values $var1 and $var2 had.