[eluser]Unknown[/eluser]
I've read the user manual about passing data to a view, and understand about passing arrays, but have a question about just sending a single variable. I admit that I'm just learning CI, so this may be pretty elementary...
In my controller I have
Code:
$login_error['error'] = ('<p class="error"> This login is incorrect </p>');
$this->load->view('login_form', $login_error);
return;
And in my view
Code:
<p class="heading">User Login</p>
<?php echo ($error); ?>
This works and all.. but just to wrap my head around it, what if I just wanted to send $error as in:
Code:
$error = ('<p class="error"> This login is incorrect </p>');
$this->load->view('login_form', $error);
return;
How would I reference that in my view? I've tried just $error, but it gives me an undefined variable error. Is data passed to the view always an array? I think thats what the user guide is trying to say, but I wanted to be sure.
Thanks...