Re: retrieve multiple select

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michael A. Peters wrote:
> PJ wrote:
>> I'm sure this has been hashed over and over on the web, only I can't
>> find anything that makes sense or the explanations given have been
>> erroneous.
>> This is what I am trying:
>> <select name="($categoriesIN).'[]'" multiple>
>>     <OPTION>Choose Categories...</option>
>>         <OPTION VALUE="1">History
>>         <OPTION VALUE="2">Temples
>>         <OPTION VALUE="3">Pharaohs and Queens
>>         <OPTION VALUE="4">Cleopatra
>>         <OPTION VALUE="5">Mummies
>>     </SELECT>
>
> Whenever something doesn't work for me I always make sure what I am
> doing is valid html/xhtml
>
> That doesn't look valid to me - multiple="multiple" might be.
> Maybe it is valid under older html.
It must be. I think I got it from some ancien post and just hadn't
changed it yet.
But if I am permitted to p&m a little, then why the dingle-bats don't
they enforce the validation. Maybe that would make everyone sit up a
little and pay attention. :-) and follow the rules, so to speak.
>
>
> But anyway, multiple selects are a bad idea because they are confusing
> for users, there's no standard way with which to choose them and users
> often don't know how - if you can use checkboxes instead.
Well, I think 60+ checkboxes get kind of garbagy and in my use it is
only the administrators who will be using this... up to now, at least. :-)
>
>
> That being said, I think your problem is the $ and the []
>
> Try
>
> <select name="categoriesIN" multiple="multiple">
>
> Then when processing the form - $_POST['categoriesIN'] will be an
> array - IE
>
> for ($i=0;$i<sizeof($_POST['categoriesIN']);$i++) {
>   do_stuff_with($_POST['categoriesIN'][$i]);
>   }
>


-- 

Phil Jourdan --- pj@xxxxxxxxxxxxx
http://www.ptahhotep.com
http://www.chiccantine.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux