cluelessnoob Posted February 1, 2009 Share Posted February 1, 2009 It automatically goes to ulog.php no matter what I $email is <?PHP $email = trim($_POST['email']); if ($email = "driver") { include ('includes/ulog.php'); echo $email; } elseif ($email = "manager") { include ('includes/mlog.php'); echo $$email; } else { include ("includes/olog.php"); echo $email; } ?> Quote Link to comment Share on other sites More sharing options...
Philip Posted February 1, 2009 Share Posted February 1, 2009 Make sure to use == instead of = in conditional statements. = set's the value, == compares it Quote Link to comment Share on other sites More sharing options...
cluelessnoob Posted February 1, 2009 Author Share Posted February 1, 2009 no kidding, I knew that and did it anyway. THX. Quote Link to comment Share on other sites More sharing options...
uniflare Posted February 1, 2009 Share Posted February 1, 2009 as a side note: = is a decleration. Declaring a variable with a value. (set) == is conditional "Equal To", can take strings and compare with boolean values and integers etc. === is a "Is Exactly As", Explanation of "==="; $string = "True"; // This is a STRING, true. $bool = true; // This is a native boolean value $integer = 1; // This is a native numeric value $nullval = null; // This is a declared NULL variable $emptyval = ""; // This is not NULL, it is just empty // consider the following statements: if($string == true){ // this works } if ($bool == true){ // this works // ONLY this will work if every statement used '===' } if ($integer == true){ // this works } if($nullval == false){ // this works } if($emptyval == null){ // this works } --- All of the above, although such different value types, will all execute. If however you use the '===' operator instead of '==', you will be testing the "Type" of the value as well, so only the type match "bool $bool == bool true" will execute. == This can be useful to know and save you some headaches. == is much more leniant than ===. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.