I am using codeigniter framework. I am getting the date from the view.i want to send them into 2 fields. like "2016-06-19" to one field and "2015-06" into another field. How can i get it done?? If anyone has an idea it would help me.
Here is my controller function.
function add() {
$reservation_model = new Reservation_model();
$reservation_service = new Reservation_service();
$newDate=$this->input->post('date',TRUE);
$splitted= split("-", $newDate, 1);
$reservation_model->set_date(trim($this->input->post('date',TRUE)));
$reservation_model->set_date_half($splitted);
$reservation_model->set_title(trim($this->input->post('selected_hall', TRUE)));
$reservation_model->set_type(trim($this->input->post('selected_time', TRUE)));
$reservation_model->set_description(trim($this->input->post('name', TRUE)));
$reservation_model->set_advanced_payment_status(trim($this->input->post('optionsRadios', TRUE)));
//$reservation_model->set_advanced_payment_status(trim($this->input->post('no', TRUE)));
$reservation_model->set_paid_amount(trim($this->input->post('paid_amount', TRUE)));
$reservation_model->set_fax(trim($this->input->post('fax', TRUE)));
$reservation_model->set_telephone_number(trim($this->input->post('telephone', TRUE)));
$reservation_model->set_address(trim($this->input->post('address', TRUE)));
$reservation_model->set_menu_no(trim($this->input->post('selected_menu_number', TRUE)));
$reservation_model->set_menu_price_per_plate(trim($this->input->post('menu_price', TRUE)));
$reservation_model->set_is_deleted('0');
//$this->db->last_query();
echo $reservation_service->add_reservation($reservation_model);
}
date is my original date. it should be like "2015-06-19". date_half is my other date field. it should be like "2015-06"