954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Get the name of the current php file

I want to make include file with a function, which among other things creates a link to the page itself, with an querystring variable added, how can i get the name of the current php file thus avoiding to have it as a string constant that has to be changed for each different page the include file is included in ?

Regards

Martin Bratbo

bratbo
Newbie Poster
3 posts since Sep 2004
Reputation Points: 10
Solved Threads: 0
 

I want to make include file with a function, which among other things creates a link to the page itself, with an querystring variable added, how can i get the name of the current php file thus avoiding to have it as a string constant that has to be changed for each different page the include file is included in ?

Regards

Martin Bratbo

$PHP_SELF :cheesy:

YoungCoder
Junior Poster
193 posts since Aug 2004
Reputation Points: 13
Solved Threads: 2
 

Or, if you (very wisely) do not have auto_globals enabled, then $_SERVER['PHP_SELF'].

Roberdin
Supreme Evil Overlord
Team Colleague
282 posts since Feb 2003
Reputation Points: 63
Solved Threads: 6
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You