title: how to fix error Cannot modify header information - headers already sent by
body: <p>I have following type of error in codeigniter, I am unable solve it any one have idea what is cause of this error.<br></p>
  
  <pre><code>A PHP Error was encountered
  
  Severity: Warning
  
  Message: Cannot modify header information - headers already sent by (output started at    /home/samples1/public_html/venture-test/application/controllers/admin/admin_notifications.php:158)
  
  Filename: helpers/url_helper.php
  
  Line Number: 540
  </code></pre>
  
  <p>I used two methods both are in same controllers as bellow.</p>
  
  <pre><code> &lt;?php
      public function approve_recent_user() {  
      $user_id = $this-&gt;uri-&gt;segment(4);
      $notification_id = $this-&gt;uri-&gt;segment(5);
      $status = 1;
      if($this-&gt;admin_notification_db-&gt;user_approve_flag($user_id,$status) == true) {
       redirect('admin/admin_notifications/unapproved_users');                
      }
      else {
          redirect('admin/admin_home');
      }
  } ?&gt;
  </code></pre>
  
  <p>after execution of this function I redirect on fo another methods as bellow.</p>
  
  <pre><code>&lt;?php 
   public function unapproved_users() {        
      $result = $this-&gt;admin_notification_db-&gt;get_unapproved_users();
      $data['users'] = $result; 
      $this-&gt;load-&gt;view('admin/recent_users', $data); 
   } ?&gt;
  </code></pre>