Here is my controller function code:
public function dispcp(){
$data = array(
'company' => $this->input->post("company"),
'fyfrom' => $this->input->post("fyfrom"),
'fyto' => $this->input->post("fyto"),
);
$this->load->view('view',$data);
}
Here the data comes from a form from another view.
this is what my code in view.php looks like :<?php print_r ($data[0]->fyfrom); ?>
Error:
Message: Undefined variable: data
Filename: views/view.php
Line Number: 14
Backtrace:
File: C:\wamp\www\admin\application\views\view.php Line: 14 Function: _error_handler
File: C:\wamp\www\admin\application\controllers\Dashboard.php Line: 586 Function: view
File: C:\wamp\www\admin\index.php Line: 263 Function: require_once
Works correctly in Controller, not in view.