title: How to fix "Cannot send headers; headers already sent" in Zend?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/8028957/headers-already-sent-by-php">Headers already sent by PHP</a>  </p>
  </blockquote>
  
  
  
  <p>I am new to zend.I tried to create simple form having two fields using zend. When i click submit button got the following error,</p>
  
  <pre><code>Fatal error: Uncaught exception 'Zend_Controller_Response_Exception' with message 'Cannot send headers; headers already sent in D:\xampp\htdocs\study\quickstart\application\controllers\EmployeeController.php, line 35' in D:\xampp\php\PEAR\Zend\Controller\Response\Abstract.php:282 Stack trace: #0 D:\xampp\php\PEAR\Zend\Controller\Response\Abstract.php(300): Zend_Controller_Response_Abstract-&gt;canSendHeaders(true) #1 D:\xampp\php\PEAR\Zend\Controller\Response\Abstract.php(727): Zend_Controller_Response_Abstract-&gt;sendHeaders() #2 D:\xampp\php\PEAR\Zend\Controller\Front.php(984): Zend_Controller_Response_Abstract-&gt;sendResponse() #3 D:\xampp\php\PEAR\Zend\Application\Bootstrap\Bootstrap.php(77): Zend_Controller_Front-&gt;dispatch() #4 D:\xampp\php\PEAR\Zend\Application.php(358): Zend_Application_Bootstrap_Bootstrap-&gt;run() #5 D:\xampp\htdocs\study\quickstart\public\index.php(25): Zend_Application-&gt;run() #6 {main} thrown in D:\xampp\php\PEAR\Zend\Controller\Response\Abstract.php  on line 282
  </code></pre>
  
  <p>I checked the following link,
  <a href="https://stackoverflow.com/questions/6045039/zend-header-already-send-problem">zend header already send problem</a></p>
  
  <p>I removed white spaces and gave close tag in all files, But still i am getting same error.</p>
  
  <p>How to fix this error ?</p>
  
  <p>Following shows <strong>EmployeeController.php</strong>:</p>
  
  <pre><code>&lt;?php 
  class EmployeeController extends Zend_Controller_Action
  {
      public function init()
      {
  
      }
      public function indexAction()
      {
  
        $form = new Default_Form_Empdetails();
         $this-&gt;view-&gt;form = $form;
          $request = $this-&gt;getRequest();
            $formData = $request-&gt;getPost();
          if ($request-&gt;isPost()) {
              if ($form-&gt;isValid($request-&gt;getPost())) {  
                  $empName = $form-&gt;getValue('empName');
                  $empAddress = $form-&gt;getValue('empAddress');
                  $emp = new Default_Model_DBTable_Employee();
                  $emp-&gt;addAlbum($empName, $empAddress);
                $this-&gt;_helper-&gt;redirector('index');
              } else {
                  $form-&gt;populate($formData);
              }
          }
  
      }
  }
  ?&gt;
  </code></pre>
  
  <p>Kindly help me </p>