$_SERVER[‘PHP_SELF’] will be used for getting current page name in php.
It will be necessary for us to use this $_SERVER[‘PHP_SELF’] for action attribute of form element if you want to post the form into the same page. If you use the filename instead of this variable then we may face difficulty when we change the file name.
If the page is located in sub-folder, then this variable will return the page name along with sub-folder name also (e.g qualtypoint/index.php)
If you want to get only the filename (e.g index.php) then you should use basename() as below.
basename($_SERVER[‘PHP_SELF’])
More Articles...
Thursday, April 30, 2009
Getting current Page Name in PHP
Related Posts
- Difference between creating objects in PHP and Python
- Sample PHP code for using Google Gemini API
- PHP developer Career opportunities suggested by Gemini
- Challenges in Developing and Testing PHP Script for Automatic Resume Submission
- PHP Code to have different number of rows in first page of PDF file generated by FPDF Library
Search This Blog

AI Course | Bundle Offer | Unlocking AI | Dream Big | Listen to Dream Big
Today's Deals | Timesheet | Products | SQL ebook | Earn 50% commission
About | Privacy | Follow | TOS | WhatsApp | Contact
I may earn a commission from Amazon affiliate links
No comments:
Post a Comment