Search code examples
zend-form-element

accessing array values in view


I have the following code in zend:

 $arrErrors=array();
     if (!empty($this->post['submit']))
    {
        // Each time theres an error, add an error message to the error array
           // using the field name as the key.
          if (empty($this->post['client_name']))
          $arrErrors['client_name'] = "Please Enter Client's name as it appears in the carrier software";
    }

if i set $this->view->arrErrors=$arrErrors in the controller, Can I access it as $this->arrErrors['client_name'] in the view?


Solution

  • i aplogize for a silly question.

    Here is right approach:

    $this->view->arrErrors=arrErrors['client_name'];
    

    Use the above code in the controller