If you have any output that is sent to the browser before you try and call header() then header's will already have been sent.
Output can be any echo statement, or even just a space before the first opening <? tag.
Have a look at
http://uk2.php.net/manual/en/function.header.php for more information on the header() function.
You can check if the headers have already been sent with
<?
if(!headers_sent()){
//headers have not been sent, send headers
header("Content-type: image/jpg");
}
else{
//headers have been sent
}
?>
Have a look at
output buffering to find out more about some techniques to help stop any content being sent until you are ready to.
Enter your message below
Sign in or Join us (it's free).