在php中插入值

I want to insert groupID to the db this is my model

public function getgroupID()
{
    $username = $this->session->userdata('username');
    $query = $this->db->query("select groupID from groups where member01ID='$username'");
    return $query->result();
}

this is my view

<?php foreach ($id as $row) {
    echo "<option value='" . $row->groupID . " '  >" . $row->groupID . " </option>";
} ?>

i can insert other values but i cant insert groupID.the problem is i dint know how to get groupID to insert(because groupID get from login information (in model))