function edit() { if (isset($_POST['save'])) { $id = $this->input->post('id'); $data = array('district_name' => trim($this->input->post('district_name')), 'state' => $this->input->post('state')); $dataIn = $this->district_model->edit($id, $data); if ($dataIn) { $this->admintemp->write('message', 'Edited Successfully'); redirect('district'); } else { $this->admintemp->write('message', 'Error occured while editing'); District::index(); } } else { District::_edit(); } }