Re: RE: $_SELF[PHP_SELF] not working anymore

From: Date: Tue, 16 Sep 2003 18:43:18 +0000
Subject: Re: RE: $_SELF[PHP_SELF] not working anymore
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-162775@lists.php.net to get a copy of this message
On Tue, Sep 16, 2003 at 03:30:39PM +0000, Curt Zirzow wrote: : * Thus wrote Maria Garcia Suarez (mariagarciasuarez@yahoo.com): : > --- Javier Tacon <javier.tacon@private.com> wrote: : > : > > Try with $_SERVER["PHP_SELF"] : > : > Then I get: : > : > Parse error: parse error, unexpected : > T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or : > T_VARIABLE or T_NUM_STRING in : > : > This is how I use it: : > $currentAddress="$_SERVER[HTTP_HOST]$_SERVER[PHP_SELF]"; : : You should always quote your array keys (cept if all the keys are : numeric. Also when inside a string, enclose your variables with : {}. : : $currentAddress="{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}"; How about: $currentAddress = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];

« previous php.general (#162775) next »