tomhoad Posted January 27, 2010 Share Posted January 27, 2010 Hi I would like to do some error reporting using GET. For example I have: The URL: www.example.com/index.php?st=not_registered $st = mysql_real_escape_string($_GET['st']); if ($st = "not_registered") {echo "<p>You are not already registered!</p>";} if ($st = "already_registered") {echo "<p>That email is already registered!</p>";} if ($st = "login_fail") {echo "<p>You are not registered! Please enter your email below.</p>";} However, that seems to ignore the value of $st and just print all the options? Thank you for your help. Link to comment https://forums.phpfreaks.com/topic/190043-php-get-with-no-variable-set/ Share on other sites More sharing options...
mattal999 Posted January 27, 2010 Share Posted January 27, 2010 You should be using ==, not =, as = on it's own declares the variable, which will technically always pass the IF test. I suggest you read up on logical operators. Link to comment https://forums.phpfreaks.com/topic/190043-php-get-with-no-variable-set/#findComment-1002661 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.