
И вот мой ВИД:
Код: Выделить всё
[h4]ADD CIT Details[/h4]
Data inserted successfully
Terminal ID
CIT
-- Select CIT --
1. CMS
2. ALPHA
Branch
COMM
Machine Type
Код: Выделить всё
function insert_cit_ctrl() {
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('', '');
$this->form_validation->set_rules('dterminalid', 'Terminal ID', 'required');
$this->form_validation->set_rules('dcit', 'CIT', 'required');
$this->form_validation->set_rules('dbranch', 'Branch', 'required');
$this->form_validation->set_rules('dcomm', 'COMM', 'required');
$this->form_validation->set_rules('dmachinetype', 'Machine Type', 'required');
if ($this->form_validation->run() == FALSE) {
echo "alert('Something wrong with your input');";
} else {
//Setting values for tabel columns
$data = array(
'terminal_id' => $this->input->post('dterminalid'),
'cit' => $this->input->post('dcit'),
'branch' => $this->input->post('dbranch'),
'comm' => $this->input->post('dcomm'),
'machine_type' => $this->input->post('dmachinetype')
);
//Transfering data to Model
$this->cit_model->modeladdcit($data);
$data['message'] = 'Data Inserted Successfully';
//Loading View
$this->load->view('template', $data);
}
}
Код: Выделить всё

Нет никакой ошибки. Просто после того, как я отправлю данные, они не появятся в моей базе данных, ни единые данные. Это означает, что данные даже не вставляются в базу данных.
Я не понимаю. Что не так с моим кодом?
ОБНОВЛЕНИЕ:
Хорошо, я последовал вашим советам, ребята, вот так:
Код: Выделить всё
Подробнее здесь: [url]https://stackoverflow.com/questions/37451561/codeigniter-form-wont-insert-data-into-database[/url]
Мобильная версия