RyanSF07 Posted March 5, 2007 Share Posted March 5, 2007 Hi All, How can I confirm multiple variables are true, as in: If AND ONLY IF 1, 2, 3, and 4 are true -- do this ___. Otherwise, do this ___. If I only confirm $a and $b (see below), this works. As soon as I throw in a couple more variables, though, it doesn't. Thanks for your help! Ryan if ($_POST[submit]) { // php validation if ($_POST[first_name] <> "") { $a = TRUE; } else { $a = FALSE; $content .= "<p>Please click your browser's BACK button and enter your first name.</p>\n"; } if ($_POST[last_name] <> "") { $b = TRUE; } else { $b = FALSE; $content .= "<p>Please click your browser's BACK button and enter your last name.</p>\n"; } if ($_POST[email] <> "") { $c = TRUE; } else { $c = FALSE; $content .= "<p>Please click your browser's BACK button and enter your email.</p>\n"; } if ($_POST[password] <> "") { $d = TRUE; } else { $d = FALSE; $content .= "<p>Please click your browser's BACK button and choose a password.</p>\n"; } if ($a.$b.$c AND $d) {............ Link to comment https://forums.phpfreaks.com/topic/41186-solved-if-this-and-this-and-this-and-this/ Share on other sites More sharing options...
fert Posted March 5, 2007 Share Posted March 5, 2007 if($a && $b && $c && $d) { } else { } Link to comment https://forums.phpfreaks.com/topic/41186-solved-if-this-and-this-and-this-and-this/#findComment-199537 Share on other sites More sharing options...
RyanSF07 Posted March 5, 2007 Author Share Posted March 5, 2007 Hi Fert, Thank you very much for your quick reply. That worked perfectly! Ryan Link to comment https://forums.phpfreaks.com/topic/41186-solved-if-this-and-this-and-this-and-this/#findComment-199545 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.