title: unset session variable in zend view
body: <p>I ll reframe my question based on some research I have done?</p>
  
  <p>I need to store lot of errors separately like $_SESSION['client_error'],$_SESSION['state_error'] etc.
  According to zend documentation do I have to store it like this for each error?</p>
  
  <pre><code>$client_error = new Zend_Session_Namespace(''client_error);
  $state_error = new Zend_Session_Namespace('state_erro'); and so on?
  </code></pre>
  
  <p>This is my code in the controller.
  I am storing it as
      $this->view->state_error_message=$state_error;</p>
  
  <p>After I echo $this->state_error in the view I want to unset it.</p>
  
  <p>Ok here are few more things I tried:
  In the controller in policyInfoAction:</p>
  
  <pre><code>    session_start();
  $error_message = new Zend_Session_Namespace('error_message');
  $error_message="TEST";
  $this-&gt;view-&gt;error_message=$error_message;
  $this-&gt;_redirect('/pdp/client-info/');
  </code></pre>
  
  <p>In the view in client-info:</p>
  
  <pre><code>session_start();
  &lt;?php echo $this-&gt;error_message; ?&gt;
  </code></pre>
  
  <p>This returns nothing.</p>
  
  <p>Ok this is my updated code:</p>
  
  <pre><code>    public function clientInfoAction()
          {
  
              $errors = new Zend_Session_Namespace('errors');
              // get the error arrays
              $client_errors = (isset($errors-&gt;client_error)) ? $errors-&gt;client_error : array();
              $state_errors  = (isset($errors-&gt;state_error)) ? $errors-&gt;state_error : array();
              unset($errors-&gt;client_error, $errors-&gt;state_error); // delete from the session
  
              // assign the values to the view
              $this-&gt;view-&gt;client_errors = $client_errors;
              $this-&gt;view-&gt;state_errors  = $state_errors;
  }
  
  
      public function policyInfoAction()
      {
  
           if (count($arrErrors) &gt; 0)
           {
  
              // The error array had something in it. There was an error.
              $strError="";
  
              foreach ($arrErrors as $error)
              {
              $strError="";
              $errors-&gt;client_error = array();
              $errors-&gt;state_error  = array();
  
  
              foreach ($arrErrors as $error)
              {
                  $strError .= $error;
                  // to add errors to each type:
                  $errors-&gt;client_error['client_error'] = $strError;
                  $errors-&gt;client_error[] = $strError;
                  $this-&gt;_redirect('/pdp/client-info/');
  
  
              }
                 }
  }
  </code></pre>
  
  <p>When i echo $this->client_errors I get 'Array'</p>