Как сделать сообщение кнопки переключателя в db при нажатии

Я пытаюсь выяснить, как сделать сообщение кнопки переключателя переключателя в db при нажатии, чтобы он мог обновить информацию: да или нет . Как кнопка отправки. Это видно из моего приложения codeigniter.

<script type="text/javascript"> jQuery(document).ready(function() { jQuery('.switch_options').each(function() { //This object var obj = jQuery(this); var enb = obj.children('.switch_enable'); //cache first element, this is equal to ON var dsb = obj.children('.switch_disable'); //cache first element, this is equal to OFF var input = obj.children('input'); //cache the element where we must set the value var input_val = obj.children('input').val(); //cache the element where we must set the value /* Check selected */ if( 'NO' == input_val ){ dsb.addClass('selected'); } else if( 'Yes' == input_val ){ enb.addClass('selected'); } //Action on user's click(ON) enb.on('click', function(){ $(dsb).removeClass('selected'); //remove "selected" from other elements in this object class(OFF) $(this).addClass('selected'); //add "selected" to the element which was just clicked in this object class(ON) $(input).val('Yes').change(); //Finally change the value to 1 }); //Action on user's click(OFF) dsb.on('click', function(){ $(enb).removeClass('selected'); //remove "selected" from other elements in this object class(ON) $(this).addClass('selected'); //add "selected" to the element which was just clicked in this object class(OFF) $(input).val('NO').change(); // //Finally change the value to 0 }); }); }); </script> 

toggle switch html code

 <div class="switch_options"> <label class="col-sm-5 control-label">Complete: </label> <span class="switch_enable"> Yes </span> <span class="switch_disable"> NO </span> <input type="hidden" class="default"value="<?php echo $e->Complete;?>"> <input type="hidden" name="Complete" class="switch_val" value=""/> </div> 

контроллер

 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Callin extends CI_Controller { function __construct() { parent::__construct(); $this->load->model('callin_model'); } //Shows the dashboard public function index() { if($this->session->userdata('logged_admin')) { $this->load->view('templates/admin_header'); $this->load->view('insert_callins_view'); }else{ redirect('admin_authentication/admin_login_show'); } } //Insert the callin public function insert_callin() { if($this->session->userdata('logged_admin')) { $data=array('Date_Scheduled'=>$this->input->post('Date_Scheduled'), 'Employee_Name'=>$this->input->post('Employee_Name'), 'Employee_Number'=>$this->input->post('Employee_Number'), 'Time_Reported'=>$this->input->post('Time_Reported'), 'Reason'=>$this->input->post('Reason'), 'Scheduled_Area'=>$this->input->post('Scheduled_Area'), 'Contact'=>$this->input->post('Contact'), 'Approval'=>$this->input->post('Approval'), 'Complete'=>$this->input->post('Complete'), 'status'=>1); //print_r($data); $result=$this->callin_model->insert_callin($data); if($result > 0) { $this->session->set_flashdata('msg',"Callin Record Added Successfully"); redirect('callin'); } else { $this->session->set_flashdata('msg1',"Callin Record Added Failed"); redirect('callin'); } }else{ redirect('admin_authentication/admin_login_show'); } } //List of callins public function list_callins() { if($this->session->userdata('logged_admin')) { $data['callin'] =$this->callin_model->get_callin(); $this->load->view('templates/admin_header'); $this->load->view('admin_callins_view',$data); }else{ redirect('admin_authentication/admin_login_show'); } } //List of callins public function viewlist_callins() { if($this->session->userdata('logged_in')) { $data['callin']=$this->callin_model->get_callin(); $this->load->view('templates/header'); $this->load->view('user_callins_view',$data); }else{ redirect('user_authentication/user_login_show'); } } public function delete_callin() { $id=$this->input->post('id'); $data=array('status'=>0); $result=$this->callin_model->delete_callin($id,$data); if($result==true) { $this->session->set_flashdata('msg1',"Deleted Successfully"); redirect('callin/list_callins'); } else { $this->session->set_flashdata('msg1',"callin Record Deletion Failed"); redirect('callin/list_callins'); } } public function edit_callin() { $id=$this->uri->segment(3); $data['callin']=$this->callin_model->edit_callin($id); $this->load->view('templates/admin_header',$data); $this->load->view('edit_callin'); } public function update_callin() { $id=$this->input->post('id'); $data=array('Date_Scheduled'=>$this->input->post('Date_Scheduled'), 'Employee_Name'=>$this->input->post('Employee_Name'), 'Employee_Number'=>$this->input->post('Employee_Number'), 'Time_Reported'=>$this->input->post('Time_Reported'), 'Reason'=>$this->input->post('Reason'), 'Scheduled_Area'=>$this->input->post('Scheduled_Area'), 'Contact'=>$this->input->post('Contact'), 'Approval'=>$this->input->post('Approval'), 'Complete'=>$this->input->post('Complete')); //print_r($data); $result=$this->callin_model->update_callin($data,$id); if($result) { $this->session->set_flashdata('msg',"Callin Record Updated Successfully"); redirect('callin/list_callins'); } else { $this->session->set_flashdata('msg1',"No changes Made in Callin Record"); redirect('callin/list_callins'); } } } ?> 

модель

 <?php class Callin_Model extends CI_Model { public function insert_callin($data) { $this->db->insert('callin_list',$data); return $this->db->insert_id(); } public function get_callin() { $this->db->select('*'); $this->db->from('callin_list'); $this->db->where('status',1); $this->db->order_by("id", "desc"); $this->db->order_by("Scheduled_Area", "desc"); $this->db->order_by("Reason", "desc"); $query =$this->db->get(); return $query->result(); } public function delete_callin($id,$data) { $this->db->where('id',$id); $this->db->update('callin_list',$data); return print_r($data); } public function edit_callin($id) { $this->db->select('*'); $this->db->from('callin_list'); $this->db->where('id',$id); $this->db->where('status',1); $query =$this->db->get(); return $query->result(); } public function update_callin($data,$id) { $this->db->where('id',$id); $this->db->update('callin_list',$data); return print_r($data); } } 

Solutions Collecting From Web of "Как сделать сообщение кнопки переключателя в db при нажатии"