TheFilmGod Posted January 11, 2008 Share Posted January 11, 2008 How do I use php to find the full address of the page the user is on? I don't need the http://www.yoursite.com stuff Only what comes after the ".com" like /elements/script_one.php or /photos/cool_stuff.php Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/85567-page-address/ Share on other sites More sharing options...
p2grace Posted January 11, 2008 Share Posted January 11, 2008 Try this: echo $_SERVER['REQUEST_URI']; Quote Link to comment https://forums.phpfreaks.com/topic/85567-page-address/#findComment-436681 Share on other sites More sharing options...
Ken2k7 Posted January 11, 2008 Share Posted January 11, 2008 Try this: echo $_SERVER['REQUEST_URI']; Note the code above also gets something like: /page.php?blah=true. If you want just /page.php, you want: echo $_SERVER['PHP_SELF']; Quote Link to comment https://forums.phpfreaks.com/topic/85567-page-address/#findComment-436852 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.