-1

I want open new web page to display the image,when my php was create the image

<?
.........
$img = $file.create_image; // $img like http://abc.com/abc.jpg
header("Location: $img");
?>

when i using header, it have a error

Cannot modify header information - headers already sent by (output....

or using other php function to open new page.

Kwan Mr
  • 69
  • 1
  • 1
  • 8
  • 2
    You are echoing something before, that's why it says that headers are already sent. If there is nothing being on echo, = .. ?> or print/print_r then you have an empty line on top of your php file (which is like echoing). – Panagiotis Apr 30 '12 at 12:09

2 Answers2

3

The headers needs to be written before any other content, this means you have to remove any white spaces/empty lines at the top of your document. You have to make sure that any HTML or echo statements is executed AFTER your header statement.

Jérémie Parker
  • 3,184
  • 2
  • 20
  • 33
0

if you're using session in this page then write ob_start(); on top of page (1st line)

Mohit Bumb
  • 2,466
  • 5
  • 33
  • 52
  • ob_start(); Warning: Cannot modify header information - headers already sent by (output started :[ – Kwan Mr Apr 30 '12 at 12:12