Re: Multiple selections
| From: | Todd Cary | Date: | Wed, 13 Nov 2002 01:06:03 +0000 |
| Subject: | Re: Multiple selections | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-124121@lists.php.net to get a copy of this message | ||
Many thanks!! One thing I do not understand in the "types" of variables is the use and referencing of a variable with the "[]". What I usually do is define a variable as
$myvar = array();
And then I use the "[]" to refer to the elements. However, if I understand you suggestion, which works like a champ, the use of the "[]" tells the interpreter to treat $myvar as an array.
Todd
Marco Tabini wrote:
Sure! Just add [] to the end of the name of the field. PHP will return all the values in an array: <select name="myvar[]"> Marco ------------------------------------------------------------------------ Subject: [PHP] Multiple selections From: Todd Cary <todd@aristesoftware.com> Date: Tue, 12 Nov 2002 16:37:43 -0800 To: "php-general@lists.php.net" <php-general@lists.php.net> I have a pull-down with the MULTIPLE attribute. If the Form is of Type GET and two values are selected (e.g. select1 and select2), I see in the URL the following: ?myvar=select1&myvar=select2 "myvar" appears twice, however, if I check the $HTTP_GET_VARS, I only have one value: myvar=select2. Is it possible to get both values? Todd-- Ariste Software, Petaluma, CA 94952