Advertisement
sebuahhobi

multiple select

Oct 17th, 2018
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.27 KB | None | 0 0
  1. <!--Controllel-->  
  2.           $data = array(
  3.                 'kamar' => $this->input->post('kamar',TRUE),
  4.                 'isi_max' => $this->input->post('isi_max',TRUE),
  5.                 'status' => $this->input->post('status',TRUE),
  6.                 'kondisi' => implode(' ',$this->input->post('kondisi',TRUE)),
  7.                 'perlengkapan' => $this->input->post('perlengkapan',TRUE)
  8.             );
  9.  
  10.             $this->Kamar_ikhwan_model->insert($data);
  11.  
  12.  
  13. <!--view-->
  14. <select id="kondisi" name="kondisi" class="select2_multiple form-control" multiple="multiple" >
  15. <option value=''>--Pilih--</option>
  16. <option value='AC Bagus'>AC BAGUS</option>
  17. <option value='AC Rusak'>AC RUSAK</option>
  18. <option value='Atap Bagus'>ATAP BAGUS</option>
  19. <option value='Atap Bocor'>ATAP BOCOR</option>
  20. <option value='Kursi Bagus'>KURSI BAGUS</option>
  21. </select>
  22.  
  23. <!-- Select2 -->
  24.     <script>
  25.       $(document).ready(function() {
  26.         $(".select2_single").select2({
  27.           placeholder: "Select a state",
  28.           allowClear: true
  29.         });
  30.         $(".select2_group").select2({});
  31.         $(".select2_multiple").select2({
  32.           maximumSelectionLength: 10,
  33.           placeholder: "Max. 10!",
  34.           allowClear: true
  35.         });
  36.       });
  37.     </script>
  38.     <!-- /Select2 -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement