title: alternative to PHP header?
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 have a class file that handles registrations and after a successful registration I want to redirect them to another page, but if I use something like:</p>
  
  <pre><code>    if(!isset($_SESSION['referer'])) {
          $_SESSION['referer'] = "home.php";
  
          header("Location: " . $_SESSION['referer']);
          exit();
      }
  </code></pre>
  
  <p>I get the error: </p>
  
  <pre><code>Warning:  Cannot modify header information - headers already sent by ...
  </code></pre>
  
  <p>Is there an alternative (non java script) way of redirecting the user to another page?</p>
  
  <p>Here is my current code flow:</p>
  
  <pre><code>// index.php file
  &lt;?php 
  include('header.php');
  include_once('classes/class.signup.php');
  
  $signUp = new SignUp();
  
  // redirect in signup.php class
  if(!isset($_SESSION['referer'])) {
      $_SESSION['referer'] = "home.php";      
      header("Location: " . $_SESSION['referer']);
      exit();
  }
  </code></pre>