Welcome Guest, Not a member yet? Register   Sign In
Dynamic data to views
#1

[eluser]joeizang[/eluser]
I don't know what is going on but I can't move just basic data that is in an array from a controller into a view. I thought i had problems with codeigniter 2.0.2 so I upgraded to CI 2.0.3 and I still can't. Here is an example of what I want to do which is basic and should work with no effort right?

Code:
$msg = array(
                'message1' => $this->ion_auth->errors(),
                'message2' => validation_errors()
            );
            
            $this->load->view('accounts/login_error',$msg);
This is from a function in my controller. and the view file carries this:

Code:
<div id="errormsg">
    <p>There where errors from your login attempt: &lt;?php foreach($msg as $ms){ echo $ms;}?&gt;</p>
    <p>Please Click &lt;?php echo anchor('accounts/index','Login');?&gt; to try again!</p>
</div>

The above code doesn't work. the above code spits out this error:


A PHP Error was encountered

Severity: Notice

Message: Undefined variable: msg

Filename: accounts/login_error.php

Line Number: 2





I even tried just doing a basic moving of static variables to my view to see if that was the problem and still don't have any luck. Can someone please lead me to the light in this matter? I don't know what to do here.

Thanks n God bless.




Theme © iAndrew 2016 - Forum software by © MyBB