codeigniter - Sending data and error from controller to view -
i have beginner problem please:
i know how pass data view below:
$data['documents'] = $this->documents_model->get_documents(); $data['main_content'] = 'document_view'; $this->load->view('layout', $data);
i know how pass errors view below:
$this->load->view('upload_view', array('error' => ''));
but how can pass both data , error view? tried placing error $data-key below, gives me word 'array' in view don't want.
$data['error'] = array('error' => '');
i tried sending $error , $data in load->view (as 2 params seperated comma) gives me syntax error. , ran out of limited ideas thought ask here.
thank advice.
try this:
$data['error'] = "your message here";
now, in view echo message this:
<?=(isset($error))?$error:''?>
Comments
Post a Comment