title: Export php form data to Excel or PDF
body: <p>I have function called "resultAction" where I store all the information in $data to print in div table.</p>
  
  <p>Now I want to export the same form data to excel.
  I want to pass the same form data to another function called "reportAction", where i failing to do that, i am returing the $data which fails.</p>
  
  <pre><code>function resultAction()
  {   
     for ($i = 0; $i &lt; count($result); $i++) {
         $data[$i]['device_type']     = $result[$i]['device_type'];
         $data[$i]['region_name']     = $result[$i]['region_name'];
     }
  
     echo  Zend_Json::encode($data);
     sleep(2);
     $this-&gt;_helper-&gt;viewRenderer-&gt;setNoRender();
     $this-&gt;_helper -&gt;layout()-&gt;disableLayout();
     return $data;
  }
  
  function reportAction()   {
      $res = $this -&gt;resultAction   // here it fails
  }
  </code></pre>