Bluehost.com Web Hosting $6.95

Get the current file name

This is a discussion on Get the current file name within the PHP General forums, part of the PHP Programming Forums category; Hi, due to a current PHP upgrade i am unable to use the following code to get the filename of ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-25-2003
Shaun
 
Posts: n/a
Default Get the current file name

Hi,

due to a current PHP upgrade i am unable to use the following code to get
the filename of the page:

$s = getenv('SCRIPT_NAME');

I need to get the filename without any avariables attached. For example if
the URL is

www.mydomain.com/test.php?test=yes

using $s = getenv('PHP_SELF');

returns test.php?test=yes

how can I return just test.php i.e. the filename on its own

Thanks for your help


Reply With Quote
  #2 (permalink)  
Old 07-25-2003
Shaun
 
Posts: n/a
Default Re: [PHP] Get the current file name

thanks for your reply,

but that doesn't seem to work either, how about removing everything after
and including the ?, how would i do that?


"Manoj Nahar" <manoj@mail15.com> wrote in message
news:3F213670.203@mail15.com...
> u can try
> $filename=$_SERVER[SCRIPT_NAME];
>
> Manoj
>
>
> Shaun wrote:
>
> >Hi,
> >
> >due to a current PHP upgrade i am unable to use the following code to get
> >the filename of the page:
> >
> >$s = getenv('SCRIPT_NAME');
> >
> >I need to get the filename without any avariables attached. For example

if
> >the URL is
> >
> >www.mydomain.com/test.php?test=yes
> >
> >using $s = getenv('PHP_SELF');
> >
> >returns test.php?test=yes
> >
> >how can I return just test.php i.e. the filename on its own
> >
> >Thanks for your help
> >
> >
> >
> >
> >

>
>
>



Reply With Quote
  #3 (permalink)  
Old 07-25-2003
Sven
 
Posts: n/a
Default Re: [PHP] Get the current file name

how about this:
$_SERVER["PHP_SELF"];
ciao SVEN

Shaun wrote:
> thanks for your reply,
>
> but that doesn't seem to work either, how about removing everything
> after and including the ?, how would i do that?
>
>
> "Manoj Nahar" <manoj@mail15.com> wrote in message
> news:3F213670.203@mail15.com...
>> u can try
>> $filename=$_SERVER[SCRIPT_NAME];
>>
>> Manoj
>>
>>
>> Shaun wrote:
>>
>>> Hi,
>>>
>>> due to a current PHP upgrade i am unable to use the following code
>>> to get the filename of the page:
>>>
>>> $s = getenv('SCRIPT_NAME');
>>>
>>> I need to get the filename without any avariables attached. For
>>> example if the URL is
>>>
>>> www.mydomain.com/test.php?test=yes
>>>
>>> using $s = getenv('PHP_SELF');
>>>
>>> returns test.php?test=yes
>>>
>>> how can I return just test.php i.e. the filename on its own
>>>
>>> Thanks for your help



Reply With Quote
  #4 (permalink)  
Old 07-27-2003
Burhan Khalid
 
Posts: n/a
Default Re[2]: [PHP] Get the current file name

On Friday, July 25, 2003, 4:59:24 PM, Shaun wrote:

S> thanks for your reply,

S> but that doesn't seem to work either, how about removing everything after
S> and including the ?, how would i do that?

try echo basename($_SERVER['PHP_SELF'])

Please trim your posts :)

--
Regards,
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 11:49 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0