[eluser]LordLaw[/eluser]
well, that not kinda like it, you forget to put var2 in myview.php which it suppose to be there.
i tested the array already, it does work if you are checking with array exist empty or not.
but in term of non-array variable, then it will produce error.
let say you get a select query result from the model and return it to controller and put it in to $data like this:
$data["row"] = $this->model->get_result(); // this is just example return col1, col2, col3
then you parse it into view
$this->load->view("edit_form", $data);
in the edit form you have 3 text box,
<form>
<text value=<?=$row->col1?>>
<text value=<?=$row->col2?>>
<text value=<?=$row->col3?>>
</form>
so, from here as you can see, if there is a result been return from database, then in the view there is no problem, but if there isnt any data return from database, then in the there will be errors occurs.
but this can be solve with :
if(!$row) {//do something }
first part done ....