Tandem Posted August 27, 2006 Share Posted August 27, 2006 I just recently moved to a different server. When i use the variable $PHP_SELF on the new server, it is coming up with the direct page rather than including the GET info. For example if the url is: www.blahblah.com/page.php?id=100, $PHP_SELF (if echoed) will be just www.blahblah.com/page.php. I was wondering if there is an alternative, or a fix for this? and if any could tell me why it's happening that would be cool too.Any help appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/18825-php_self/ Share on other sites More sharing options...
AndyB Posted August 27, 2006 Share Posted August 27, 2006 Sounds like a register_globals setting difference. Try $_SERVER['PHP_SELF'] instead. Quote Link to comment https://forums.phpfreaks.com/topic/18825-php_self/#findComment-81231 Share on other sites More sharing options...
Tandem Posted August 27, 2006 Author Share Posted August 27, 2006 That gives the same result. I'm gonna send a message to my host and see if they know what is wrong. Quote Link to comment https://forums.phpfreaks.com/topic/18825-php_self/#findComment-81236 Share on other sites More sharing options...
wildteen88 Posted August 27, 2006 Share Posted August 27, 2006 Use $_SERVER['QUERY_STRING'] to get the bit after the ? in the url. PHP_SELF only gets the relative path to the file, it doesnt include the query string. So use this:[code=php:0]$url = $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];[/url] Quote Link to comment https://forums.phpfreaks.com/topic/18825-php_self/#findComment-81277 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.