djfox Posted February 2, 2008 Share Posted February 2, 2008 I tried using php.net to look this up myself but it keeps saying it has an internal error. So! What I would like to do is have the script check what the current url is, like if the page is currently explore.php or today.php Link to comment https://forums.phpfreaks.com/topic/89017-solved-quick-q-checking-current-url/ Share on other sites More sharing options...
Stooney Posted February 2, 2008 Share Posted February 2, 2008 $_SERVER['PHP_SELF'] Link to comment https://forums.phpfreaks.com/topic/89017-solved-quick-q-checking-current-url/#findComment-455869 Share on other sites More sharing options...
pocobueno1388 Posted February 2, 2008 Share Posted February 2, 2008 $page = $_SERVER['PHP_SELF']; echo $page; Link to comment https://forums.phpfreaks.com/topic/89017-solved-quick-q-checking-current-url/#findComment-455870 Share on other sites More sharing options...
djfox Posted February 2, 2008 Author Share Posted February 2, 2008 It isn`t picking it up it seems, did I do it correctly? <?php if ($_SERVER['PHP_SELF'] == explore.php){ $whereloc = "Exploring"; } ?> Link to comment https://forums.phpfreaks.com/topic/89017-solved-quick-q-checking-current-url/#findComment-455872 Share on other sites More sharing options...
Stooney Posted February 2, 2008 Share Posted February 2, 2008 try <?php if ($_SERVER['PHP_SELF'] == "/explore.php"){ echo 'explorer.php'; } ?> Link to comment https://forums.phpfreaks.com/topic/89017-solved-quick-q-checking-current-url/#findComment-455882 Share on other sites More sharing options...
djfox Posted February 2, 2008 Author Share Posted February 2, 2008 Oh, all I needed was that slash? Ok, thanks a bunch! Link to comment https://forums.phpfreaks.com/topic/89017-solved-quick-q-checking-current-url/#findComment-455884 Share on other sites More sharing options...
pocobueno1388 Posted February 2, 2008 Share Posted February 2, 2008 Oh, all I needed was that slash? Ok, thanks a bunch! You needed to wrap the "explor.php" in quotes. Link to comment https://forums.phpfreaks.com/topic/89017-solved-quick-q-checking-current-url/#findComment-456082 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.