RE: [PHP] Re: Help please: Unable to get $_POST["variable"]; to w ork in a form.
| From: | Ford, Mike [LSS] | Date: | Wed, 11 Dec 2002 11:48:45 +0000 |
| Subject: | RE: [PHP] Re: Help please: Unable to get $_POST["variable"]; to w ork in a form. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-127789@lists.php.net to get a copy of this message | ||
> ----- Original Message -----
> From: "Victor" <siliconhype@yahoo.ca>
> To: "'Rick Emery'" <remery@emeryloftus.com>
> Sent: Tuesday, December 10, 2002 1:49 PM
> Subject: RE: [PHP] Re: Help please: Unable to get
> $_POST["variable"]; to work in a form.
>
>
> Why are you using $_POST[""]? I thought you had to use $_POST['']. I
> always use '' instead of "" and it always works. Is it just
> me? Can one
> really use double quotes?
Of course you can -- it's just a string! The difference, as with all
strings, is in whether you want variable names to be interpolated or not.
Consider:
$num = 3;
$array = array('var 3'=>'Interpolated!', 'var
$nuum'=>'Not
Interpolated');
echo $array['var $num']; // => Not Interpolated
echo $array["var $num"]; // => Interpolated!
echo $array['var '.$num]; // => Interpolated!
Of course, an arrray subscript can be any expression, so to go to extremes I
could even do something like:
$x = 1;
$y = 2;
$a = 'a';
echo $array['v'.$a."r ".($x+$y)]; // => Interpolated!
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211