ted_chou12 Posted December 23, 2006 Share Posted December 23, 2006 doesnt work!!!can anyone help me?[code]<?php$url = $_SERVER['PHP_SELF'];echo $url;if ("$url" == "/index.php"){echo "current";}?>[/code]ThanksTed, Quote Link to comment https://forums.phpfreaks.com/topic/31695-if-url-indexphpecho-current/ Share on other sites More sharing options...
wildteen88 Posted December 23, 2006 Share Posted December 23, 2006 Is the file you are running the code called index.php? Quote Link to comment https://forums.phpfreaks.com/topic/31695-if-url-indexphpecho-current/#findComment-146905 Share on other sites More sharing options...
HuggieBear Posted December 24, 2006 Share Posted December 24, 2006 For starters I'd remove the quotes around $url[code]<?php// get just the filename, no additional slashes or anything$url = basename($_SERVER['PHP_SELF']);// now look for just the file (I've removed the additional slash)if ($url == "index.php"){ echo "current";}?>[/code]RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/31695-if-url-indexphpecho-current/#findComment-147265 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.