RE: [PHP] retrieve multiple select
| From: | Boyd, Todd M. | Date: | Mon, 02 Mar 2009 22:04:20 +0000 |
| Subject: | RE: [PHP] retrieve multiple select | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-289083@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Shawn McKenzie [mailto:nospam@mckenzies.net]
> Sent: Monday, March 02, 2009 3:41 PM
> To: php-general@lists.php.net
> Subject: Re: [PHP] retrieve multiple select
>
> Shawn McKenzie wrote:
> > 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.
> >
> > HTML 4.01
> >
> > multiple [CI]
> > If set, this boolean attribute allows multiple selections. If
not
> > set, the SELECT element only permits single selections.
> >
>
> However, all the options should be closed.
>
> Instead of: <OPTION VALUE="1">History
>
> Use: <OPTION VALUE="1">History</OPTION>
>
> Also, you should move the <OPTION>Choose Categories...</option> out of
> the select or you'll get it as an array item if someone actually
> selects
> it. You could I guess set it to disabled also.
I believe if you just do <option value="">Choose something</option> it's
pretty easy to discard an empty value if that's what they've selected.
// Todd