[eluser]maria clara[/eluser]
@the prodigy,
i tried what you said,but it don't post still the data i inputted in the fields???
is it in the model??
Code:
function save($data,$item,$details) {
if ($item == '') {
$data['link'] = "reports/view";
$this->db->trans_start();
$this->db->insert('sec_reports', $data);
$item = $this->db->insert_id();
$this->save_detail($item,$details);
$this->db->trans_complete();
if ($this->db->affected_rows() == '1')
{
return TRUE;
}
return FALSE;
}
this is now my controller looks like.
Code:
$config['upload_path'] = './reports/module/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '100';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
if ( $this->upload->do_upload())
{
$file_data = $this->upload->data();
//$file_name = $file_data['file_name'];
$fields = array(
"module_name"=>$this->input->post('module_name'),
"slug"=>$this->input->post('slug'),
"icon"=>$this->input->post('file_name'),
"report_file_name"=>$this->input->post('report_file_name'),
"sql_select"=>$this->input->post('sql_select'),
"sql_filter"=>$this->input->post('sql_filter'),
"sql_order"=>$this->input->post('sql_order')
);
/*foreach ($fields as $field)
{
if (isset($_POST[$field])) $dt[$field] = $this->input->post($field);
}*/
//$fields = $this->input->post("fields");
$item = $this->input->post("item");
$rows = $this->input->post("row0");
$data['item'] = $this->Reports->save($fields,$item,$rows);
$c .= 'Successfully saved item';
}
else
{
$error = array('error' => $this->upload->display_errors());
//$this->load->view('at_reports', $error);
}
}
$data['response'] = $c;
$json['json'] = $data;