⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Multiple Select and add multiple row to same table once



aziz30

aziz30
  • profile picture
  • Member

Posted 11 April 2018 - 07:09 AM

In my project there is a dependent dropdown. I want to select multiple data from dropdown sometime all data, and all the data will insert to same table not to many to many relational table. My code is below --- 

 

 

$this->load->library('grocery_CRUD');
$crud = new grocery_CRUD();

$crud->set_theme('flexigrid');
$crud->set_table('tbl_donation_ppl');
$crud->set_relation('fld_home_id', 'tbl_home_name', 'fld_name');
$crud->set_relation('fld_user_id','tbl_recipient', 'fld_name');
$crud->set_relation('fld_itemgrp_id', 'tbl_donate_group', 'fld_grp_name');
 
$crud->columns('fld_don_type', 'fld_home_id', 'fld_user_id', 'fld_itemgrp_id', 'fld_date', 'fld_details');
$crud->required_fields('fld_don_type','fld_home_id','fld_user_id', 'fld_itemgrp_id', 'fld_date');
$crud->display_as('fld_done_type', 'Donation Type');
$crud->display_as('fld_home_id', 'Home Name');
$crud->display_as('fld_user_id', 'Receipient');
$crud->display_as('fld_itemgrp_id', 'Donation Item');
$crud->display_as('fld_date', 'Donation Date');
$crud->display_as('fld_details', 'Details');
 
$crud->change_field_type('fld_don_type', 'dropdown', array('iftar' => 'ইফতার','jakat' => 'যাকাত','home' => 'ঘর'));
$crud->field_type('fld_user_id', 'multiselect');
 
$fields = array(
                //District Field
                'fld_home_id' => array(
                'table_name' => 'tbl_home_name',
                'title' => 'fld_name',
                'relate' => null
                ),
                'fld_user_id' => array(
                'table_name' => 'tbl_recipient',
                'title' => 'fld_name',
                'id_field' => 'fld_uid',
                'relate' => 'fld_home_id',
                'data-placeholder' => 'Select Home'
                ),
            );

$config = array(
                'main_table' => 'tbl_home_name',
                'main_table_primary' => 'fld_uid',
                'url' => base_url() . 'index.php/libraries/makedonationppl/'
            );

            $usrs = new gc_dependent_select($crud, $fields, $config);

            $js = $usrs->get_js();
            $output = $crud->render();

            $output->output.=$js;

            $this->__mycrud($output);

 

I want to multi select 'tbl_recipient'  and add as many row as selected item. But I can select only one item at once to tbl_donation_ppl table, is there any way to achieve it? Thanks in advance.

 

screenshot here == https://imgur.com/a/yTpee