PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
wmasterh
Forum Newbie
Posts: 1 Joined: Thu Sep 19, 2002 8:57 am
Location: Stockholm, Sollentuna
Post
by wmasterh » Thu Sep 19, 2002 8:57 am
I am making a community and wonder if there s any function in PHP to retrive the name of the page wich is loaded:
Code: Select all
www.ed.ed/rf/tg/userVS.php?name=4fun
what I would like to be able to capture in a string i the:
to able to add another variable later with something like:
I hope you can help me!
twigletmac
Her Royal Site Adminness
Posts: 5371 Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK
Post
by twigletmac » Thu Sep 19, 2002 9:05 am
You can use:
Code: Select all
$file_name = basename($_SERVERї'PHP_SELF']);
to get the name of the current page.
It's also easy to add the query string information:
Code: Select all
$file_name_with_query_string = $file_name.'?'.$_SERVERї'QUERY_STRING'];
Mac
~J~R~R
Forum Newbie
Posts: 20 Joined: Wed Sep 18, 2002 12:19 pm
Location: Amsterdam, the Netherlanda
Post
by ~J~R~R » Thu Sep 19, 2002 9:05 am
Code: Select all
$url = array_pop(explode('/', $_SERVERї'PHP_SELF']));
I think that's it.
[edit]i think twigletmac is located closer to the server than i[/edit]