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. 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. 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. 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] Link to comment https://forums.phpfreaks.com/topic/18825-php_self/#findComment-81277 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.