Re: Variables with - in their name

From: Date: Mon, 19 Nov 2012 17:10:55 +0000
Subject: Re: Variables with - in their name
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-319737@lists.php.net to get a copy of this message
On 19-11-2012 10:49, Alessandro Pellizzari wrote:
Il Sun, 18 Nov 2012 01:09:11 -0500, Ron Piggott ha scritto:
echo "<select name=\"distributor-" . $row['promo_code_prefix'] . "-" . $row['promo_code_suffix'] . "\" style=\"text-align: center;\">\r\n";
It could be wrote: <?php echo $distributor-42-2;
You MUST disable register_globals in your php.ini Once you have done that (and even before that...) you find your variable in $_POST['distributor-42-2'] (or $_GET, depends on your form method) Bye. I agree it should *always* be disabled, however even when it is ENabled, $_POST or $_GET (and also $_REQUEST) will always include that key and value, regardless of the setting on register_globals.
In general though, it is most wise to DISable register_globals and code assuming it always will be disabled. - Tul

« previous php.general (#319737) next »