grabbing the url from a page php is embedded in

43 Views Asked by At

I am trying to create a toolbar on the bottom of my page using php. It should be dynamic and it should not include links for the page it is embedded in. When i use the following code.

$path = $_SERVER['SCRIPT_NAME'];

It grabs the url of the page toolbar.php. I am attempting to grab the page the toolbar PHP is embedded in. Any Ideas?

1

There are 1 best solutions below

0
Kylie On BEST ANSWER

Use $_SERVER['REQUEST_URI']

$full_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";

Or...

$page = basename($_SERVER['PHP_SELF']);