Controller Code
$params = array(
'c_rate' => $this->input->post('c_rate'),
'fid' => $this->input->post('fid'),
'c_adv' => $this->input->post('c_adv'),
'c_date' => $this->input->post('c_date'),
'cnam' => $this->input->post('cnam'),
'c_add' => $this->input->post('c_add'),
'c_totalw' => $this->input->post('c_totalw'),
'c_labl' => $this->input->post('c_labl'),
'c_labout' => $this->input->post('c_labout'),
'c_extra' => $this->input->post('c_extra'),
'c_vehicle' => $this->input->post('c_vehicle'),
'c_vehown' => $this->input->post('c_vehown'),
'c_totpur' => $this->input->post('c_totpur'),
'total_amount' => $this->input->post('total_amount'),
);
$cutt1_id = $this->Cutt1_model->add_cutt1($params);
redirect('cutt1/index');
Код модели [Сложение и вычитание полей и выборки данных перед отправкой ... всего поля Покупка] [1]
[1]: https://i.stack.imgur.com/9IUyx.jpg `function get_all_cutt1 (){$ this-> db-> order_by ('cut_id', 'desc');return $ this-> db-> get ('cutt1') -> result_array ();} / * * функция для добавления нового cutt1 * / function add_cutt1 ($ params) {$ this-> db-> insert ('cutt1', $ params);return $ this-> db-> insert_id ();
Views Code
* Всего покупок input-> post ('c_totpur');?> "class =" form-control "id =" c_totpur "/>`