Possible Duplicate:
Headers already sent by PHP
my website was running fine till i shifted to the hostgator server , but after switching i found errors on every page .
Cannot modify header information - headers already sent by (output started at /home/flip/public_html/index.php)
i opened up my code and i read some where not to put up html before <?php ?>
my code started like this
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?php 
@session_start();
include_once("includes/connection.php");
$id=$_SESSION['user_id'];
    if(!isset($_SESSION['user_id']))
    {
      header("location:index.php");
    }
        if (!isset($_GET["event"])) {
            $caseVar = "share";
        } else {
            $caseVar = $_GET["event"];
        }
?>
and it was running fine in previous server but when i switched to new it started giving header errors in each and every page . but later on i put the doctype after the <?php ?> and it started working as before . i really wanted to know why this happened .cant html be written before <?php ?>  and will i have to change my code everytime i switch from server to server ?
 
     
     
     
    