Using the REQUEST_URI statement...
Posted 24 October 2006 - 01:50 PM
echoing this gives me the current URL that is being used. However, I would like to get it to only show the name of the html page that is being used.
For example, currently if the url is "http://localhost/ind...ex.htm?g=2&h=4", and I echo $currentt I want it only to return "index.htm" not the entire url...
Does anyone know of a way that this can be done?
Posted 24 October 2006 - 02:24 PM
$full_path = getenv("REQUEST_URI"); //retrieves the full url
$pagename = basename($full_path); //retrieves the name of the html page youre using (with or without any url parameters)....
$currentt = substr($pagename //makes sure only the html page name getx extracted...
, strrpos($pagename, "/")
, strpos($pagename, ".html"));
The above variable $currentt will extract the name of the current html page thats being used and nothing but....
Posted 24 October 2006 - 02:25 PM
<?php echo $_SERVER['SCRIPT_NAME']; ?>
Posted 24 October 2006 - 03:31 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users