Edit file File name : Types_of_property.php Content :<?php class Types_of_property extends CI_Controller{ public function add_type_of_property(){ $this->load->model('types_of_property_model'); $data=$this->types_of_property_model->get_types_of_property(); $this->load->view('header'); $this->load->view('types_of_property_list',["test"=>$data]); $this->load->view('footer'); } public function Create_type_of_property(){ if(isset($_SESSION['users'])){ $this->load->view('header'); $this->load->model('Properties_model'); $prt=$this->Properties_model->get_properties(); //print_r($prt); //exit; $this->load->view('Create_type_of_property',['properties'=>$prt]); $this->load->view('footer'); } else{ redirect('User_login'); } } public function add_Types_of_properties(){ echo $type=$this->input->post('type'); echo $updated_by=$this->input->post('updated_by'); $this->load->model('types_of_property_model'); $id=$this->types_of_property_model->add_types_of_property($type,$updated_by); redirect('Types_of_property/add_type_of_property'); } public function delet_Types_of_property(){ $id=$this->input->get('types_of_property_id'); $this->load->model('types_of_property_model'); if($this->types_of_property_model->delet_Types_of_property($id)) { redirect('Types_of_property/add_type_of_property'); }else{ print('data can not be delet'); } } public function edit_Types_of_property(){ if(isset($_SESSION['users'])){ $this->load->view('header'); $id=$this->input->get('types_of_property_id'); $this->load->model('types_of_property_model'); $data=$this->types_of_property_model->selectdata($id); $this->load->model('Properties_model'); $prt=$this->Properties_model->get_properties(); //print_r($prt); //exit; $this->load->view('Type_of_edit_form',['data'=>$data,'properties'=>$prt]); $this->load->view('footer'); }else{ redirect('Types_of_property/add_type_of_property'); } } public function updatedata(){ $id=$this->input->post('id'); $type=$this->input->post('type'); $updated_by=$this->input->post('updated_by'); $this->load->model('types_of_property_model'); if($this->types_of_property_model->update_data($id,$type,$updated_by)){ redirect('Types_of_property/add_type_of_property'); }else{ print('Error in update data'); } } public function signout(){ session_destroy(); redirect('/User_login'); } public function logout(){ session_destroy(); redirect('/User_login'); } } ?> Save