RE: [PHP] Multiple Select Stuff
| From: | Michael Richardson | Date: | Mon, 07 Aug 2000 15:54:00 +0000 |
| Subject: | RE: [PHP] Multiple Select Stuff | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-10489@lists.php.net to get a copy of this message | ||
Mr. Lerdorf:
It is possible to use php to determine whether each element of the array was
selected previously, and then write the tags using javascript to select
them.
The javascript synatax is like follows:
"('option name', 'option value', '', true)" // for selected
"('option name', 'option value')" // for not selected
so all that would be needed is to write the javascript using an if/else on
whether the particular option is included in the array.
If you need more exact syntax please ask, I can provide a close example
script. I don't have time to write one for the exact purpose, but you could
figure it out with little research (and a good book).
Respectfully:
Michael Richardson
-----Original Message-----
From: Rasmus Lerdorf [mailto:rasmus@php.net]
Sent: Saturday, August 05, 2000 6:44 PM
To: John Coggeshall
Cc: Jon Parise; php general
Subject: Re: [PHP] Multiple Select Stuff
> Okay, Say you having something like...
>
> <SELECT NAME="myselect[]" MULTIPLE>
> <OPTION VALUE="abc">ABC</OPTION>
> <OPTION VALUE="def">DEF</OPTION>
> <OPTION VALUE="ghi">GHI</OPTION>
> </SELECT>
>
> when you post it to the script, you'll get an array like....
>
> $myselect = array(0=>"abc",
> 1=>"def",
> 2=>"ghi");
>
> Is there *any* way to change the array indexing? I.E.
>
> $myselect = array("ABC"=>"abc",
> "DEF"=>"def",
> "GHI"=>"ghi");
>
> My problem is I'd like PHP to select certain options in the list that the
> user selected perviously. Does that make sense?
>
> Any suggestions?
Don't see how that could be done. All elements in a select widget must
have the same name.
-Rasmus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net