FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


storing current page address as php variable





ChrisCh
Hey Smile Ok does anyone know how to store a page address as a php variable? The address that I'm trying to store would be the one currently being browsed by a user. To make it a bit clearer, the page headers would be shown by something like this:
Code:
include ('something.php');

and all other contents of the page would just be loaded as HTML code as contained in the actual php file that has been loaded (eg home.php).
However, in the something.php file that is being used to show headers, is it possible to store the address of the home.php file as a variable (ie. the actual address shown in the address bar?)

Does anyone know how to do this? Smile
Stubru Freak
Have a look at this: http://be2.php.net/manual/en/reserved.variables.php#reserved.variables.server

There should be something like that there.
fritz06
$site_uri = getenv("REQUEST_URI");

is it? Very Happy
Agent ME
I always use
Code:
$_SERVER['PHP_SELF']

It returns a string of the filename of the page. Like if I was browsing http://www.lol.com/abc/123.php, the variable would return '/123.php'.
PatTheGreat42
There are some wonderful built-in constants with PHP with information like the URL, the filename, and the file path. Yay built in constants!
Related topics
php get current page name
Getting PHP variable to work in FCKeditor
pass varaibles to another page in PHP
Want to see a phpinfo page showing php settings?
E-Cards with PHP & MySQL
How to create a dynamic PHP website.
Countdown Javascript with PHP variables
AJAX tutorial [2nd part now updated]
how to make a php nav
PHP Image Questions
HTTP Referer...
please please beta test it (PHP coders)
Validation help needed
PHP
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.