Jump to content

Archived

This topic is now archived and is closed to further replies.

Tandem

$PHP_SELF

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Sounds like a register_globals setting difference.  Try $_SERVER['PHP_SELF'] instead.

Share this post


Link to post
Share on other sites
That gives the same result. I'm gonna send a message to my host and see if they know what is wrong.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.