Jump to content

Why $_SERVER['php_self'] doesn't work?


hno

Recommended Posts

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.)

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?

$_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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.