platformOS Community

How can I store data to database from multiple select dropdown ?

MrMKJ Jul 15 2021 at 06:45

Please help me with this

Rich - One Orange Cow Aug 02 2021 at 12:12

I had the same issue, POS doesn't support variables of the same name via a form POST or GET (even though this is a web standard). To get around it in javascript I loop the mutliselect elements and generate a hidden input and then pass that along with the form

Edit: Sorry I just realized I might not have answered your question, yes standard multiselect forms don't display on the backend correctly but if you name your select dropdown (for example) as name="something[]" (note the square brackets [ ] ) the data will be transfered as an array with all the options.

Pawel Aug 11 2021 at 14:23

As Rich correctly pointed out, you need to send an array of values. It is pretty common practice to use [] for arrays and hashes notations.


<input type="textbox" name="cars[honda][]", value="CRX">
<input type="textbox" name="cars[honda][]", value="S2000">
<input type="textbox" name="cars[honda][]", value="NSX">


<input type="textbox" name="cars[honda][model_name]", value="CRX">
<input type="textbox" name="cars[honda][engine_size]", value="1600">
<input type="textbox" name="cars[honda][seats]", value="4">
Please sign in or fill up your profile to answer a question