DeanWhitehouse Posted May 19, 2008 Share Posted May 19, 2008 why does this work <?php if(isset($_GET['image_catergory'])== "add") { ?> the link for it is http://darkflame.awardspace.com/admin_area.php?image_catergory=add but it shows when i have http://darkflame.awardspace.com/admin_area.php?image_catergory BTW there is more code than that , but i just thought that you only need to see this bit. Thanks, Blade Quote Link to comment https://forums.phpfreaks.com/topic/106323-solved-simple-_get-question/ Share on other sites More sharing options...
rhodesa Posted May 19, 2008 Share Posted May 19, 2008 it should say: if(isset($_GET['image_catergory']) && $_GET['image_catergory'] == "add") the reason: isset() returns TRUE or FALSE depending on if the variable (or array key in this case) is set. For the second url you provided, the image_category key is set, but it's set to an empty string. Even though, it's an empty string, isset() will return TRUE. So then, you are basically comparing TRUE to 'add'. Since PHP is very loose with it's variables, 'add' technically is equal to TRUE because it's not FALSE, 0 or NULL. Quote Link to comment https://forums.phpfreaks.com/topic/106323-solved-simple-_get-question/#findComment-544888 Share on other sites More sharing options...
corbin Posted May 19, 2008 Share Posted May 19, 2008 http://us.php.net/isset It returns a boolean of whether or not it's set, not the actual value. if(isset($_GET['image_category']) && $_GET['image_category'] == 'add') { } Edit: Someone beat me to it. I'm posting it anyway. Quote Link to comment https://forums.phpfreaks.com/topic/106323-solved-simple-_get-question/#findComment-544889 Share on other sites More sharing options...
DeanWhitehouse Posted May 19, 2008 Author Share Posted May 19, 2008 ok, thanks guys, u solved it Quote Link to comment https://forums.phpfreaks.com/topic/106323-solved-simple-_get-question/#findComment-544892 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.