PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Iam doing a project on bookmarking and i want to get the url of a page automatically when the user clicks a button.
the problem is that i have a common header layout that is applied on all pages and i want to put the bookmark button on the header so that i will get it on all pages.
but now iam getting only the url of the include page(example.php) and not getting the intended result.i need the url of the page where the header comes.anyone please help.thanks in advance.
i have problems with $_SERVER['PHP_SELF'] . I got 2 pages one is bookmark.php and other example.php.
I'm using include function to include the example.php inside bookmark.php. While accessing the $_SERVER['PHP_SELF'] i'm getting " temp/example.php" as URL in place of "temp/bookmark.php".
Can any one tell how to get the desire Url "temp/bookmark.php" when i use include function....?
mahi130 wrote:i have problems with $_SERVER['PHP_SELF']
You aren't really having problems with the variable, your understanding of it is incorrect. $_SERVER['PHP_SELF'] return the name of the file currently being executed, hence your problem.
The Manual wrote:
The filename of the currently executing script, relative to the document root. For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar would be /test.php/foo.bar. The __FILE__ constant contains the full path and filename of the current (i.e. included) file. If PHP is running as a command-line processor this variable contains the script name since PHP 4.3.0. Previously it was not available.
mahi130 wrote:the problem is that i have a common header layout that is applied on all pages and i want to put the bookmark button on the header so that i will get it on all pages.
Is it possible to add the bookmark button to the layout in the file containing the header?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering