title: Call to a member function getValue() on a non-object in /var/www/docs/Project.com/public/application/controllers/ClientController.php on line 31
body: <p>I am trying to insert a data into database and display it in grid but getting an error Call to a member function get Value() on a non-object. </p>
  
  <p>Here is my controller code.</p>
  
  <pre><code>public function addAction()
  {
  $form = new Application_Form_user();
  $form-&gt;submit-&gt;setlabel('add');
  $this-&gt;view-&gt;form = $form;
  
  if($this-&gt;getRequest()-&gt;isPost())
  {
  
      $formData= $this-&gt;getRequest()-&gt;getPost();
  
      if($form-&gt;isvalid($formData))
  
          $client= new Application_Model_DbTable_Client();
  
      $firstname = $formData-&gt;getValue('firstname');
              $lastname = $formData-&gt;getValue('lastname');
              $email = $formData-&gt;getValue('email');
  
           echo"&lt;pre&gt;";
               print_r($fisrtname);die;   
               $client-&gt;addClient($firstname,$lastname,$email);
  
               $this-&gt;_helper-&gt;redirector('index');
       }
  
  }
  </code></pre>
  
  <p>My model code.</p>
  
  <pre><code>public function addClient($firstname,$lastname,$email)
  {
  
    $data=array('fisrtname'=&gt;$firstname,
                'lastname'=&gt;$lastname,
                 'email'=&gt;$email);
    $this-&gt;insert($data); 
  }
  </code></pre>
  
  <p>Here is my user form code. </p>
  
  <pre><code>class Application_Form_user extends Zend_Form
  {
    public function init()
  {
      $id = new Zend_Form_Element_Hidden('id');
      $id-&gt;addFilter('Int');
  
      $firstname = new Zend_Form_Element_Text('firstname');
      $firstname-&gt;setlabel('firstname');
      $firstname-&gt;setRequired('true');
  
  
      $lastname = new Zend_Form_Element_Text('lastname');
      $lastname-&gt;setlabel('lastname');
      $lastname-&gt;setRequired('true');
  
      $email = new Zend_Form_Element_Text('email');
      $email-&gt;setlabel('email');
      $email-&gt;setRequired('true');
  
      $submit = new Zend_Form_Element_Submit('submit');
      $submit-&gt;setlabel('submit');
      $submit-&gt;setRequired('true');
  
  
      $this-&gt;addElements(array($id, $firstname, $lastname, $email, $submit));
  }                      
  </code></pre>
  
  <p>}</p>