You are here: Re: <select multiple> « PHP Language « IT news, forums, messages
Re: <select multiple>

Posted by Carl on 12/29/05 02:50

Sunny wrote:
> Hi
>
> In a form I use a multiple selection section.
>
> <select name="Xes" multiple><option
> name="some_indexed_id">some_text</option>
>
> How can I retrieve all the choices made in that <select> ?
>
> $_POST["Xes"] only gives one value even if I choose many.
>
>
> Thanks
>
>

Sunny,

I think you want your from to look more like this:

<select name="Xes[]" multiple>
<option value="1">some_text</option>
<option value="2" >other_text</option>
<option value="3">more_text</option>
</select>

Notice that only the select tag has the name property, and the options
only have value properties. Also, notice the '[]' at the end of the
select name property value.

After submitting this form, check the value of $_POST['Xes']( or
$_GET['Xes'] if your form action is "get"), which will contain an array
of the values selected.

Hope that helps,
Carl.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация