Page 1 of 1

How to find out what page I am on?

Posted: Fri Jul 28, 2006 7:27 pm
by matt1019
Hi guys,

Sorry if the subject/title is a little vague...

Here's my question:

If I want to find out what page I am on and the page uses "=" as in http://www.mysite.com/index.php?user=512

then I can say:

Code: Select all

if(isset(user))
{
echo "user id is $user";
}
but how do I find what page I am on, based on the address only (without "?user=" part) as in http://www.mysite.com/view/photos.php

viewing page: photos

example two: http://www.mysite.com/interact/chat.php

viewing page: chat

see what I am saying?
Bascially, with the above format, I CANNOT use isset.... so I cannot find out what page I am on.

Is there any way to do this BESIDES using cookies?
(any php method?)

thanks for your help guys,

-Matt

Posted: Fri Jul 28, 2006 7:29 pm
by Burrito
$_SERVER['PHP_SELF']

Posted: Fri Jul 28, 2006 10:58 pm
by feyd
forum search term: geturl

Posted: Sat Jul 29, 2006 12:30 am
by RobertGonzalez
basename()

Code: Select all

<?php
$thispage = basename(__FILE__, '.php');
?>

Posted: Sat Jul 29, 2006 11:26 am
by matt1019
Thanks Guys,

Worked out! I used Everah's technique ;)

And also thanks to feyd and Burrito for their efforts!


Regards,

-Matt