php - how to split an array from an array from a desired part when have 1 to many relationship working on codeignitor -


i have data comming from gropup_id dropdown multiple selection want insert values in data table not gropup_id want extract separate array , insert table later.

    array(11) {   ["full_name"]=>   string(5) "gjiut"   ["username"]=>   string(3) "hhj"   ["password"]=>   string(0) ""   ["confirm_password"]=>   string(0) ""   ["email"]=>   string(26) "eshopdesigners11@gmail.com"   ["company_id"]=>   string(1) "1"   ["phone"]=>   string(3) "123"   ["mobile"]=>   string(3) "123"   ["skype_id"]=>   string(3) "123"   ["role_id"]=>   string(1) "1"   ["gropup_id"]=>   array(3) {     [0]=>     string(1) "1"     [1]=>     string(1) "2"     [2]=>     string(1) "3"   } } 

my table relation ship

user table

id  user_name 

group table

id group_name 

user_group_table

user_id group_id 

i tried not working

 $post = $this->input->post();       $postarray = $post;     $secondaryarray = array();      foreach ($postarray $key => $value) {          if (strpos($value, "gropup_id") != false)             $secondaryarray[] = $value;          unset($post[$key]);     } 

gropup_id key, not value in postarray.

instead of

if (strpos($value, "gropup_id") != false) 

do

if ( $key == "gropup_id" ) 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -