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
Post a Comment