session; $data['pageTitle'] = "Account Types"; switch ($alias) { case 'add': if (isset($_POST['submit'])) { $TableData = array( 'acgroup_code' => filter_var($_POST['acgroup_code']), 'acgroup_name' => filter_var($_POST['acgroup_name']), 'created_on' => date('Y-m-d H:i:s'), 'created_by' => 'admin', 'remarks' => filter_var($_POST['remarks']), 'status' => 1, 'display_order' => filter_var($_POST['display_order']), ); $this->db->insert('tbl_acgroups', $TableData); redirect("master/acgroups"); } loadView("acgroups/add", $data); break; case 'edit': if (isset($_POST['submit'])) { $id = $this->uri->segment(4); $TableData = array( 'acgroup_code' => filter_var($_POST['acgroup_code']), 'acgroup_name' => filter_var($_POST['acgroup_name']), 'created_on' => date('Y-m-d H:i:s'), 'created_by' => 'admin', 'remarks' => filter_var($_POST['remarks']), 'status' => 1, 'display_order' => filter_var($_POST['display_order']), ); $this->db->where('acgroup_id', $id); $this->db->update('tbl_acgroups', $TableData); redirect("master/acgroups"); } loadView("acgroups/edit", $data); break; case 'delete': $id = $this->uri->segment(4); $this->db->where('acgroup_id', $id); $this->db->where('acgroup_id not in (select acgroup_id from tbl_accategories)'); $this->db->delete('tbl_acgroups'); redirect("master/acgroups"); break; default: loadView("acgroups/list", $data); } } }