Page 1 of 1

fetching current pagename

Posted: Wed Apr 26, 2006 5:11 am
by itsmani1
here is url:
http://127.0.0.1/atlantared/admin/adminhome.php
I am on above url page
now i want to fetch current page name? how i can do so, mean i want to fetch adminhome.php form this

http://127.0.0.1/atlantared/admin/adminhome.php?ab=12
will this method also apply on 2nd url or not? if not how can i use it for 2nd URL

Posted: Wed Apr 26, 2006 5:14 am
by shiznatix
check your $_SERVER superglobal array :)

Posted: Wed Apr 26, 2006 5:22 am
by itsmani1
shiznatix wrote:check your $_SERVER superglobal array :)
how can i access this array
By using :

$_SERVER['......']

Posted: Wed Apr 26, 2006 5:24 am
by shiznatix
yes exactally.

to view this array do

Code: Select all

echo '<pre>';
print_r($_SERVER);
echo '</pre>';
then find what you are looking for and use it just like you would use the $_POST array, $_GET array, or a regular array.

Posted: Wed Apr 26, 2006 5:34 am
by itsmani1
Thanks much.

Posted: Wed Apr 26, 2006 5:41 am
by Oren

Code: Select all

basename($_SERVER['PHP_SELF'])