title: codeigniter displaying form_open
body: <p>I am trying to learn codeigniter and for some reason I can't do the simplest of things.</p>
  <p>Basically I am creating a form on a login page. But I am getting</p>
  <blockquote>
  <p>Fatal error: Call to undefined function validation_errors() in A:\work\codeigniter\ci\application\views\pages\login.php on line 5</p>
  </blockquote>
  <p>and if I comment out the validation_errors line, I get</p>
  <blockquote>
  <p>Fatal error: Call to undefined function form_open() in A:\work\codeigniter\ci\application\views\pages\login.php on line 5
  ...</p>
  </blockquote>
  <p>Error message</p>
  <pre><code>( ! ) Fatal error: Call to undefined function validation_errors() in A:\work\codeigniter\ci\application\views\pages\login.php on line 3
  Call Stack
  #   Time    Memory  Function    Location
  1   0.0004  697328  {main}( )   ..\index.php:0
  2   0.0010  790176  require_once( 'A:\work\codeigniter\ci\system\core\CodeIgniter.php' )    ..\index.php:202
  3   0.0135  2313080 call_user_func_array ( )    ..\CodeIgniter.php:359
  4   0.0135  2313160 Pages-&gt;view( )  ..\CodeIgniter.php:359
  5   0.0135  2313288 CI_Loader-&gt;view( )  ..\pages.php:9
  6   0.0135  2314232 CI_Loader-&gt;_ci_load( )  ..\Loader.php:419
  7   0.0138  2363392 include( 'A:\work\codeigniter\ci\application\views\pages\login.php' )   ..\Loader.php:833
  </code></pre>
  <p>This is my code:</p>
  <p>login.php located at view\pages</p>
  <pre><code>&lt;?php echo validation_errors(); ?&gt;
  
  &lt;?php echo form_open('user/login') ?&gt;
  
      &lt;label for=&quot;Id&quot;&gt; User Id&lt;/label&gt;
      &lt;input type=&quot;input&quot; name=&quot;Id&quot; /&gt; &lt;br/&gt;
      
      &lt;label for=&quot;Password&quot;&gt;User Password&lt;/label&gt;
      &lt;input type=&quot;input&quot; name=&quot;Password&quot; /&gt;
      &lt;br/&gt;
      
      &lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;log in&quot; /&gt;
      
  &lt;/form&gt;
  </code></pre>
  <p>user.php located at controllers\</p>
  <pre><code>&lt;?php
      class User extends CI_controller{
      public function login()
      {
          $this-&gt;load-&gt;helper('form');
          $this-&gt;load-&gt;library('form_validation');
          
          //i have a file views/pages/main.php which just says &quot;this is main&quot;
          $this-&gt;load-&gt;view('pages/main'); 
      }
      }
  </code></pre>
  <p>pages.php located at controllers/</p>
  <pre><code>&lt;?php
  
      class Pages extends CI_Controller{
      public function view($page){
          if(!isset($page)||!file_exists(&quot;application/views/pages/$page.php&quot;)){
          show_404();
          }
          
          $this-&gt;load-&gt;view(&quot;pages/$page&quot;);
          
          
      }
      }
  </code></pre>
  <p>routes.php located at config/</p>
  <pre><code>$route['default_controller'] = &quot;pages/view&quot;;
  $route['(:any)']=&quot;pages/view/$1&quot;;
  $route['404_override'] = '';
  </code></pre>
  <p>this is what I think happens and if I am wrong, please correct me.
  form_open('user/login') makes the &quot;action&quot; of the html form element point to a method &quot;login&quot; of class &quot;user&quot; located in controlers.</p>
  <p>also, I googled a lot and pretty much everyone else that was getting this error was getting it because they hadnt done</p>
  <pre><code>$this-&gt;load-&gt;helper('form');
  $this-&gt;load-&gt;library('form_validation');
  </code></pre>
  <p>Also, I don't get the string in form_open points to the location for the &quot;action&quot; attribute in the html form element. Why is it neccessary to load form helper and form validation library there? Can someone explain the flow of this, please?</p>