Re: Multiple Select And Javascript Issue - AMMENDED TO ARRAY QUESTION
| From: | David Robley | Date: | Fri, 25 Aug 2000 06:24:18 +0000 |
| Subject: | Re: Multiple Select And Javascript Issue - AMMENDED TO ARRAY QUESTION | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-13595@lists.php.net to get a copy of this message | ||
On 25 Aug, Grant Walters wrote:
>
> I have hit a snag anyway as I tried the following:
>
> I created a second SELECT group that is updated with the selected option set
> to true. Works beuatifully except you can't hide a SELECT input field.
> So...
>
> I now have a INPUT HIDDEN field called "items[]" which I populate with all
> of the options from the SELECT list (more later).
>
> This is good except for one thing. While PHP decides that the variable is
> an array because of the [], it contains only one element with all of the
> options, so...
>
> When I build the string for the field, is there a terminator I can use to
> trick PHP into recognising it as the end of an array element?
>
> Such as document.formName.['items[]'].value = "0\nfirst item\n1\nsecond
> item\n3\nthird item\n"
>
> In the mean time I'll just modify the code to "explode" the values.
>
> Regards
>
> GRANT WALTERS
> Walters & Associates, P O Box 13-043, Johnsonville, Wellington, New Zealand
> Phone: +64 4 4765175 CellPhone: 025 488265
My thought now would be to just pass a field called items, populate it
with the options and separate them by a suitable character on which you
can explode into an array in the receiving script, assuming you want to
deal with it as an array. You can't generally pass arrays as arrays. See
also serialize and unserialize.
Cheers
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA