a1amattyj Posted May 15, 2008 Share Posted May 15, 2008 Hey Guys, With my page now, i have a $_GET issue, What i want to happen is, if i view the page, forums.php or forums.php?page=BLAH then it will display the code ive got down. Other codes are in this file, for example if($_GET['act'] == 'delete'){ etc etc. So far ive tried : if($_GET && $_GET['page']){ If i visit forums.php?page=BLAH, it displays correctly but if i visit forums.php, nothing. My initial thought was : if(!$_GET && $_GET['page']){ But they contradict each other? Is it possible or should i just place this in a separate php file ? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/105717-_get-problem/ Share on other sites More sharing options...
conker87 Posted May 15, 2008 Share Posted May 15, 2008 if (GET['page']) { //do stuff } else { // no GET page, so do something else. } Quote Link to comment https://forums.phpfreaks.com/topic/105717-_get-problem/#findComment-541650 Share on other sites More sharing options...
MadTechie Posted May 15, 2008 Share Posted May 15, 2008 if (GET['page']) should be if ($_GET['page']) personally i would do this <?php $page = (!empty($_GET['page']))?strtolower($_GET['page']):""; switch($page) { default: //below is the defautl page case "page1": echo "Page 1"; break; case "page2": echo "Page 2"; break; case "etc": echo "etc"; break; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/105717-_get-problem/#findComment-541657 Share on other sites More sharing options...
conker87 Posted May 15, 2008 Share Posted May 15, 2008 if (GET['page']) should be if ($_GET['page']) I'm tired, give me a break break; Quote Link to comment https://forums.phpfreaks.com/topic/105717-_get-problem/#findComment-541691 Share on other sites More sharing options...
MadTechie Posted May 15, 2008 Share Posted May 15, 2008 I'm tired, give me a break lol, i know you know, but it was a1amattyj benifit lol, Quote Link to comment https://forums.phpfreaks.com/topic/105717-_get-problem/#findComment-541697 Share on other sites More sharing options...
a1amattyj Posted May 15, 2008 Author Share Posted May 15, 2008 Ta guys. Works perfectly. Quote Link to comment https://forums.phpfreaks.com/topic/105717-_get-problem/#findComment-541714 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.