Possible Duplicate:
Headers already sent by PHP
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:
if(!isset($_SESSION['referer'])) {
$_SESSION['referer'] = "home.php";
header("Location: " . $_SESSION['referer']);
exit();
}
I get the error:
Warning: Cannot modify header information - headers already sent by ...
Is there an alternative (non java script) way of redirecting the user to another page?
Here is my current code flow:
// index.php file
<?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();
}