I try this code to get the filename
echo $_SERVER[‘PHP_SELF’];
and it did return the filename but it look like this:
/login.php
how could I get the filename without the slash before it?
thanks for any help.
I try this code to get the filename
echo $_SERVER[‘PHP_SELF’];
and it did return the filename but it look like this:
/login.php
how could I get the filename without the slash before it?
thanks for any help.
Try this:
[php]$self = substr($_SERVER[‘PHP_SELF’], 1, (strlen($_SERVER[‘PHP_SELF’]) - 1));[/php]
That should basically take the length of PHP_SELF and then throw out the first character.
You could also use, str_replace()
[php]
<? echo str_replace("/","",$_SERVER['PHP_SELF']); //Will give you: login.php ?>[/php]
Thanks for all you help. It works.
What about basename() ?