function updatePosition() { $positionList = $this->input->post('positionList'); $idList = $this->input->post('idList'); $locations = new Province(); for ($i = 0; $i < count($idList); $i++) { $locations->where("id", $idList[$i]); $locations->get(); $locations->position = $positionList[$i]; $locations->save(); $locations->clear(); } redirect("admin/locations/listAll/"); }