Page 1 of 1

i want to use html select controle with multiple property

Posted: Wed Jun 17, 2009 5:57 am
by lokesh_kumar_s
hi i want to use html select controle with multiple property

Code: Select all

 
<select multiple="multiple" name="DrpEmployee" style="width: 173px">
<option>select1</option>
<option>select2</option>
<option>select3</option>
</select>
 
so to get multiple celected values in drop down list what can i do in PHP

Thanks,
lokesh

Re: i want to use html select controle with multiple property

Posted: Wed Jun 17, 2009 6:07 am
by mattpointblank
<option selected="selected">Value</option>

Re: i want to use html select controle with multiple property

Posted: Wed Jun 17, 2009 6:15 am
by lokesh_kumar_s
mattpointblank wrote:<option selected="selected">Value</option>
No i telling how can i access it
like $emp=$_POST['emp'];

Re: i want to use html select controle with multiple property

Posted: Wed Jun 17, 2009 6:18 am
by papa
Access it as any POST or GET var when form is submitted.

Re: i want to use html select controle with multiple property

Posted: Wed Jun 17, 2009 6:41 am
by mattpointblank
Change the <select> field's name to 'DrpEmployee[]' (add the brackets to make it an array), then you can access an array of the selected options with $_POST['DrpEmployee'].