Below is my controller. On adding I can see the datetime picker but it is not saving to database.
public function new_user_employment(){
$this->load->library('session');
$userid = $_SESSION['logged_in']["user_profile_id"];
$this->load->library('grocery_CRUD');
$this->load->database();
$this->load->helper('url');
$crud = new grocery_CRUD();
echo "<h2>Registration Form - Employment Details</h2>";
$crud->set_theme('datatables');
$crud->set_subject('Employment Details');
$crud->set_table('user_employment_details');
$crud->set_relation('user_profile_id','user_profile','id');
$crud->where('user_profile_id',$userid);
$crud->required_fields('company_name','title','date_from','date_to','address1','address2','city','state','zip','country','work_email');
$crud->set_relation('country','country','country_name');
$crud->columns(array('company_name','title','date_from','date_to','address1','address2','city','state','zip','country','work_email'));
$crud->add_fields(array('company_name','title','date_from','date_to','address1','address2','city','state','zip','country','work_email'));
$crud->edit_fields(array('company_name','title','date_from','date_to','address1','address2','city','state','zip','country','work_email'));
$crud->change_field_type('user_profile_id','invisible');
$crud->change_field_type('added_on','invisible');
$crud->change_field_type('added_by','invisible');
$crud->change_field_type('updated_by','invisible');
$crud->unset_export();
$crud->unset_print();
$crud->callback_insert(array($this,'insert_employment'));
$output = $crud->render();
$this->_example_output($output);
}
function insert_employment($post_array) {
$user_employment_insert = array(
"user_profile_id" => $_SESSION['logged_in']["user_profile_id"],
"company_name" => $post_array["company_name"],
"title" => $post_array["title"],
"date_from" => $post_array["date_from"],
"date_to" => $post_array["date_to"],
"address1" => $post_array["address1"],
"address2" => $post_array["address2"],
"city" => $post_array["city"],
"state" => $post_array["state"],
"zip" => $post_array["zip"],
"country" => $post_array["country"],
"work_email" => $post_array["work_email"],
"added_on" => date('Y-m-d H:i:s'),
"added_by" => 'Web Registration',
"updated_by" => 'Web Registration'
);
return $this->db->insert('user_employment_details',$user_employment_insert);
}
// END - Store employment data in database -Author/Reviewer