Reply to Re: action="<?=$PHP_SELF?>">

Your name:

Reply:


Posted by Rik on 06/06/07 22:15

On Thu, 07 Jun 2007 00:03:09 +0200, zoilus <zolius@someplace.org> wrote:=


> I had been trying this one and a few others without success, until I =

> used this
>
> // $PHP_SELF=3D$_SERVER['PHP_SELF']; //r&d
> // print "$PHP_SELF"; //r&d
>
> The above worked while others just blanked my php output.

Some pointers:

- Never ever use the <?=3D$varname ?> syntax. (Which assumes both shortt=
ags =

and register_globals set to On, both of which are a Bad Idea)

- Do not expect any magic variable to exist except the ones listed on =

http://www.php.net/manual/en/language.variables.predefined.php (well, =

including $this in classes etc.)

Also, putting double quotes around a single variable to echo, print, or =
do =

anything else with it is just plain silly. All it does is it casts it to=
a =

string, which is already assumed by echo/print constructs. If you really=
=

need to cast it to a string, using strval() (only for scalars) or =

(string)$varname is preferred. See =

http://www.php.net/manual/en/language.types.type-juggling.php for more =

details on this.


Short answer:
<?php echo $_SERVER['PHP_SELF']; ?> works almost all the time, depending=
=

on what webserver you use (as it isn't provided by PHP itself, the serve=
r =

tells PHP what it should be).
-- =

Rik Wasmus

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация