user10292634
user10292634

Reputation:

How to pass the selected data from Select2 Minimal?

How can I pass data from the selection, is it via AJAX or direct to controller? Im using Codeigniter for the framework and AdminLTE for the admin theme.

Here's my HTML CODE:

<div class="col-sm-10">
   <select class="form-control select2" style="width: 100%;">
      <?php foreach ($donates as $index => $donate) : ?>
         <option selected="selected" id="m_id" name="m_id">
         <?php echo $donate->m_id; ?>
         </option>
       <?php endforeach; ?>
    </select>
</div>

Upvotes: 0

Views: 132

Answers (1)

sathya seelan
sathya seelan

Reputation: 184

You have to set name for the select node instead of option node. For example

<select name="m_id">
    <option value="1" selected>1</option>
</select>

Happy coding :)

Upvotes: 1

Related Questions