hno Posted June 29, 2009 Share Posted June 29, 2009 HI I want to get the current open page url and for that reason i use $_SERVER['php_self'] but it doesn't return anything.What is the problem and is there any other method for doing that? thanks Link to comment https://forums.phpfreaks.com/topic/164050-why-_serverphp_self-doesnt-work/ Share on other sites More sharing options...
PFMaBiSmAd Posted June 29, 2009 Share Posted June 29, 2009 Because it's $_SERVER['PHP_SELF'] (upper case.) In programming, everything is exact because computers only do exactly what their code and data tells them to do. And you should be learning php, developing php code, and debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON in your php.ini to get php to help you (the lower case version would have produced a error alerting you to a non-existent variable.) Link to comment https://forums.phpfreaks.com/topic/164050-why-_serverphp_self-doesnt-work/#findComment-865405 Share on other sites More sharing options...
hno Posted June 29, 2009 Author Share Posted June 29, 2009 Because it's $_SERVER['PHP_SELF'] (upper case.) In programming, everything is exact because computers only do exactly what their code and data tells them to do. And you should be learning php, developing php code, and debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON in your php.ini to get php to help you (the lower case version would have produced a error alerting you to a non-existent variable.) thanks but the url in the browser is this:"http://localhost/bazareiran/index.php?option=com_jumi&fileid=6&Itemid=7"and when i use $_SERVER['PHP_SELF'] it just prints:"/bazareiran/index.php" but i want all of the content after index.php.How should i do that? Link to comment https://forums.phpfreaks.com/topic/164050-why-_serverphp_self-doesnt-work/#findComment-865437 Share on other sites More sharing options...
iSE Posted June 29, 2009 Share Posted June 29, 2009 $_SERVER['QUERY_STRING']; give you all the stuff after the question mark, or alternatively: $_SERVER['REQUEST_URI']; gives you that plus the page. Look here for more: http://us2.php.net/manual/en/reserved.variables.server.php The $_SERVER global variable replaces the old $HTTP_SERVER_VARS for PHP 4 users Link to comment https://forums.phpfreaks.com/topic/164050-why-_serverphp_self-doesnt-work/#findComment-865502 Share on other sites More sharing options...
MasterACE14 Posted June 29, 2009 Share Posted June 29, 2009 echo $_GET['option']."<br />"; echo $_GET['fileid']."<br />"; echo $_GET['Itemid']."<br />"; Link to comment https://forums.phpfreaks.com/topic/164050-why-_serverphp_self-doesnt-work/#findComment-865507 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.