I am trying to get confirmation message before deleting the data, and also I would like to maintain my data in database while deleting them in frontend . here is my (project) index.php view
<div class="main-sec-contant"> <div class="ProjectsDetails"> <h2 class="heading">Projects Details</h2> <div class="row"> <div class="col-md-12"> <table id="table_id" class="display"> <thead> <tr> <th>Project Name</th> <th>Client Name</th> <th>Company</th> <th>Project Manager</th> <th>Support Staff</th> <th>Status</th> <th>Actions</th> </tr> </thead> <tbody> <?php foreach($project as $n) { ?> <tr> <td><?php echo $n->project_name;?></td> <td><?php echo $n->client_name;?></td> <td><?php echo $n->company;?></td> <td><a class="pro-circle"><img class="img-sm" src="<?php echo site_url('assets/image/man.png');?>" data-toggle="tooltip" data-placement="bottom" title="<?php echo $n-> project_manager;?>" data-original-title="Click to deactivate the user"></a>   </td> <td><a class="pro-circle"><img class="img-sm" src="<?php echo site_url('assets/image/man.png');?>" data-toggle="tooltip" data-placement="bottom" title="<?php echo $n-> support_staff;?>" data-original-title="Click to deactivate the user"></a>   <a class="pro-circle"><img class="img-sm" src="<?php echo site_url('assets/image/man.png');?>"></a>   <a class="pro-circle"><img class="img-sm" src="<?php echo site_url('assets/image/man.png');?>"></a></td> <td><span class="icoact"></span> Active</td> <td><a class="edit" href="<?php echo site_url('admin/project/edit/'.$n->id);?>"><i class="fa fa-pencil-square-o" ></i></a>  <a class="delete" href="<?php echo site_url('admin/project/delete/'.$n->id);?>"><i class="fa fa-trash-o"></i></a></td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> Here is my Project.php controller
public function index () { $data['company_name'] = $this->project_model->getAllCompanyName(); $data['project'] = $this->project_model->getProjectDetails(); $this->load->view('admin/project/index',$data); } function delete($id) { $this->project_model->delete($id); $this->session->set_flashdata ('success','Project Deleted Sucessfully'); redirect('admin/project/index'); } And here is my Project_model.php , delete function
function getProjectDetails() { //table (projects) $delete_flag=0; $data['project'] = $this->db->get_where('projects',array('delete_flag!='=>$delete_flag))->result_array(); }
function getById($id) { return $this->db->get_where('projects',array('id'=>$id))->row(); } function delete($id) { $delete_flag=0; $this->db->where('id',$id)->update('projects',array('delete_flag'=>$delete_flag)); } Right now I am able to delete the data successfully from both frontend and database, I would appreciate if you can help me how I can get the confirmation message, and also maintain my data in database while deleting them from frontend ?
Here is the database table
