nostrodamned Posted February 13, 2009 Share Posted February 13, 2009 Hi all, I am trying to write an if statement that displays a banner depending on the URL that is requested. Basically I want to do this IF URL is the main page ie http://www.mysite.com or http://mysite.com or /index.php (with no parameters) then Do this If it is index.php with parameters or any other page Do this I hope that makes sense!! Thanks for any help. Link to comment https://forums.phpfreaks.com/topic/145055-identify-url-with-php/ Share on other sites More sharing options...
gunabalans Posted February 13, 2009 Share Posted February 13, 2009 Hai try this this is using switch case <?php $v= $_GET['data from url'] switch($v) { case 'tutorials' #do sothng break; case 'articles' #do sothng else break; default: #make the default action break; } ?> Link to comment https://forums.phpfreaks.com/topic/145055-identify-url-with-php/#findComment-761187 Share on other sites More sharing options...
gevans Posted February 13, 2009 Share Posted February 13, 2009 You could just check the query string; <?php if(empty($_SERVER["QUERY_STRING"])) { //just index.php } else { //index.php?with-some-request } Link to comment https://forums.phpfreaks.com/topic/145055-identify-url-with-php/#findComment-761189 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.