0

Here is my code:

                            <div class="input-group" id="sector">
                                <span class="input-group-addon">Sector</span>
                                <select class="form-control"  multiple>
                                    <? foreach ($sectors as $row): ?>
                                        <option value="<?= $row['sector']; ?>">
                                        <?= $row['sector']; ?></option>
                                    <? endforeach; ?>
                                </select>
                            </div>

I want to send the multiple selected value to controller.I have tried but only last selected value is posted, not all. Can you please guide me??

Ash
  • 35
  • 7

1 Answers1

0

Make a hidden field and as you select the drop down add the value to the hidden field with comma separation using javascript/jquery. Finally when form is posted you can get the data with comma. You can use explode it by comma.

Aju John
  • 2,214
  • 1
  • 10
  • 27