php codeigniter Я хочу перенаправить эту функцию print_view, а также передать данные $this->db->insert('invoice_main',$datas);$result = $this->db->insert_id();
Public function insert_invoice(){
$item_name = $_POST['item'];
$rate = $_POST['rate'];
$quantity = $_POST['quantity'];
$tax = $_POST['tax'];
$amount = $_POST['amount'];
$invoice_id = $this->input->post('invoice_id');
//$invoice_id++;
$datas = array(
'user_id' => $this->session->userdata('user_id'),
'invoice_id' => $this->input->post('invoice_id'),
'pt_opnum' => $this->input->post('pt_opnum'),
'pt_uhid' => $this->input->post('pt_uhid'),
'doc_name' => $this->input->post('doc_name'),
'status'=>1
);
$this->db->insert('invoice_main',$datas);
$result = $this->db->insert_id();
for ($i=0; $i <count($item_name) ; $i++) {
$data=array(
'invoice_id' =>$invoice_id,
'pt_name'=> $this->input->post('pt_opnum'),
'date'=>date('d-m-Y'),
'name'=>$item_name[$i],
'rate'=>$rate[$i],
'quantity'=>$quantity[$i],
'tax'=>$tax[$i],
'amount'=>$amount[$i],
'sub_total'=>$_POST['sub_total'],
'o_tax'=>$_POST['o_tax'],
'grand_total'=>$_POST['grand_total'],
'status'=>1
);
$this->db->insert('invoice_details',$data);
}
return($this->db->affected_rows()!=1)?false:true;
$this->print_view($result);
}
public function print_view($result){
redirect(base_url()."invoice/print_view/".$result);
}