Hello
Please I need to be able to save multiple items items to a model using a dropdown list. I have searched all around the web and could not find a solution. Basically my problem is this: I have offices and need to assign users to selected offices. I should be able to select multiple users from a drop down list and add them to the database as well as edit the added users.
How do I achieve this in yii2?
Sample code:
<select multiple="multiple">
<option value =‘1’>Daniel Bahm</option>
<option value =‘2’>Susan Hardy</option>
<option value =‘3’>Gabriel Dan</option>
</select>
I need sample controller code explaining how to save multiple items from a drop down list to the database, as well as update the list of saved items. By default yii2 can easily handle saving and updating single items from a dropdown list but I am yet to find an example on the net where multiple items were saved from a dropdown and updated.
Any sample code will be appreciated