title: How to check form validation in controller in Zend Framework 1.12
body: <p>How do I check if the form is validated or not, and how do I show the error message if the form is not according to the validations</p>
  
  <p>In zf2 we write as</p>
  
  <pre><code>userController
  
  $request = $this-&gt;getRequest();
  $form = new Form_LoginForm();
  if($request-&gt;isPost()){
      if($form-&gt;isvalid($this-&gt;_request-&gt;getPost())){
          $authAdapter = $this-&gt;getAuthAdapter();
          $username = 'john';
          $password = '123';
          $authAdapter-&gt;setIdentity($email)
                      -&gt;setCredential($password);
          $auth = Zend_Auth::getInstance();
          $result = $auth-&gt;authenticate($authAdapter);
          if($result-&gt;isvalid()){
              $identity = $authAdapter-&gt;getResultRowObject();
              $authStorage = $auth-&gt;getStorage();
              $authStorage-&gt;write($identity);
              $this-&gt;_helper-&gt;redirector(register/user);
              echo 'valid';
          } else {
              $this-&gt;view-&gt;errorMessage = "User name or password is incorrect";
          }
      }
  }
  </code></pre>
  
  <p>The above code is in zend framework2 , I need  the code in <code>Zend framework 1.12</code>. How do I get the form from <code>login.phtml</code> into userController and how to write the code to check for validation as in line 4 which is written in zend framework2</p>
  
  <p>My <code>login.phtml</code> form is</p>
  
  <pre><code>    &lt;form action="&lt;?php echo $this-&gt;url(array('controller'=&gt;'user','action'=&gt;'login'),
      'default',true);?&gt;" method="post"&gt;
      Email: &lt;input type="text" name="user_email" type="email"            oninvalid="setCustomValidity('Plz enter valid email ')"      onchange="try{setCustomValidity('')}catch(e){}" required /&gt;
      Password: &lt;input type="password" name="password" required /&gt;
      &lt;input type="submit" name="submit" value="SUBMIT"  /&gt;
      &lt;/form&gt;
  </code></pre>