arrays - Codeigniter pass post information to view along with database result of the post information -
i have form collects customername
, period
, unitofmeasure
[buom].
i pass information controller puts post data array , passes view.
this controller works 100% currently.
function new_blank_order_lines() { if($this->input->post()){ $data = array( 'customer' =>$this->input->post('customer'), 'period' =>$this->input->post('period'), 'buom' =>$this->input->post('buom') ); $this->session->set_userdata($data); $this->sales_model->get_creditlimit($this->input->post('customer')); } $this->load->view('sales/new_blank_order_lines',$this->session->all_userdata()); } else { redirect('/sales/permerror'); } }
what want query customers credit limit
, credit balance
using customer post value , pass view use in next form.
so model is:
function get_creditlimit($customer) { $this->db->select('creditlimit','creditbalance'); $this->db->from('customers'); $this->db->where('customername',$customer); $q = $this->db->get(); if($q->num_rows() > 0) { return $q->result(); } }
so in controller calling model function with: $this->sales_model->get_creditlimit($this->input->post('customer'));
here passing customer
post value model fetch correct credit limit? correct?
my question how pass post information array view , credit limit information view.
do need add model result array , pass single array? if how do this?
thanks always,
just add $data array:
$data = array( 'customer' =>$this->input->post('customer'), 'period' =>$this->input->post('period'), 'buom' =>$this->input->post('buom'), 'creditlimit' => $this->sales_model->get_creditlimit($this->input->post('customer')) );
Comments
Post a Comment