php - How do i make an option panel with multiple option value's set? -
i have option panel in selected name id set in database. select multiple options , set more name id's one.
the code option panel this:
<select name="werknemer[]" data-placeholder="werknemers..." class="chzn-select" id="werknemer" tabindex="4"> <option value=""></option> <?if($werknemers !=null):foreach($werknemers $row):?> <option value='<?=$row->idwerknemer;?>'><?=$row->voornaam;?> (<?=$row->achternaam;?>)</option> <?endforeach;endif;?> </select><br /></div></div>
this works perfect select multiple "idwerknemer" in 1 option value. how make work? have tried multiple style. doesnt post anything.
<select multiple> <option value="volvo">volvo</option> <option value="saab">saab</option> <option value="opel">opel</option> <option value="audi">audi</option> </select>
your code become
<select name="werknemer[]" multiple data-placeholder="werknemers..." class="chzn-select" id="werknemer" tabindex="4"> <option value=""></option> <?if($werknemers !=null):foreach($werknemers $row):?> <option value='<?=$row->idwerknemer;?>'><?=$row->voornaam;?> (<?=$row->achternaam;?>)</option> <?endforeach;endif;?> </select>
keyword "multiple". see : http://www.w3schools.com/tags/att_select_multiple.asp
after selecting few values in selectoption, post form.
you $_post this:
array ( [werknemer] => array ( [0] => 1 [1] => 2 ) )
see example of checkbox : multiple checkbox options on php form
Comments
Post a Comment