title: codeigniter - pass messages to view
body: <p>I am new to codeigniter. I have a controller <code>users</code> which loads a <code>login</code> view.</p>
  
  <pre><code>class user extends CI_Controller {
      function __construct()
      {
          parent::__construct();
          $this-&gt;load-&gt;helper(array('form'));
      }
      public function login()
      {
          $this-&gt;load-&gt;model('user_images');
          $data = $this-&gt;load-&gt;model('login');
          $this-&gt;load-&gt;view('login', $data);
      }
  }
  </code></pre>
  
  <p>In the <code>login</code> model I handle all the validation and processing. If there is a validation error or the like I return <code>$data['msg'] = 'some error message';</code> I pass this data via <code>$data = $this-&gt;load-&gt;model('login');</code> to <code>$this-&gt;load-&gt;view('login', $data);</code> and in view I echo <code>$msg</code>. However upon submission the form processes, if I enter the correct credentials I get logged in, however if I enter some wrong credentials the validation errors do not get passed to the view. I am moving this project over from an non-framework environment, so I am sure that the validation rules work .etc. I am just not sure why the messages are not getting parsed on the view.</p>