shamuraq Posted April 18, 2009 Share Posted April 18, 2009 Hi guys, I'm trying to script a PDF conversion tool for every of my pages. When i try to echo the page/file name to the PDF script using $_SERVER['PHP_SELF'],$_SERVER['QUERY_STRING'], $_SERVER['SCRIPT_FILENAME'], $_SERVER['SCRIPT_NAME'] etc. it keeps returning "index.php". Is there anyway i can point directly to the files that i placed the button for pdf conversion? Thanx Quote Link to comment https://forums.phpfreaks.com/topic/154695-current-file-info/ Share on other sites More sharing options...
.josh Posted April 19, 2009 Share Posted April 19, 2009 you mean like an absolute url path? echo $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF']; Quote Link to comment https://forums.phpfreaks.com/topic/154695-current-file-info/#findComment-813605 Share on other sites More sharing options...
Rithiur Posted April 19, 2009 Share Posted April 19, 2009 I'm not sure what exactly you're after, but you if you need the path to the currently executing file in php, you can use the __FILE__ magic constant. You can read more about it here: http://www.php.net/manual/en/language.constants.predefined.php Quote Link to comment https://forums.phpfreaks.com/topic/154695-current-file-info/#findComment-813652 Share on other sites More sharing options...
gffg4574fghsDSGDGKJYM Posted April 19, 2009 Share Posted April 19, 2009 If you are looking for the previous page you can use $_SERVER['HTTP_REFERER'] but as php.net say it's unreliable : The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted. http://www.php.net/manual/en/reserved.variables.server.php You should store in a database the pdf file name and use a post form with a id of the row. Quote Link to comment https://forums.phpfreaks.com/topic/154695-current-file-info/#findComment-813695 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.