QA.TechInterviews.com - your tech questions answered
About: Warning: Cannot Modify Header Information - Headers Already Sent By (Output Started At...?
I received message:Warning: Cannot modify header information - headers already sent by (output started at......) when i run my website.I have checked space before and after <?php ?>...But i received above massage.I remove all of code and wrote :
<?php
header(location: http://www.yahoo.com);
?>
But it still dont run and i still received above message.
Can you help me? Thanks
header("Location:login.php");
exit();
Make sure that the location is Location (I don't know if it is picky about that) and that everything in the parenthesis is in quotes, like:

header("Location: http://www.yahoo.com";);

So the whole page should be:

<?php
header("Location: http://www.yahoo.com";);
?>

And nothing else. There shouldn't be anything else before the header.
header("Location:login.php");
exit();
You can also try output buffering:

<?php

ob_start();
header("Location: ...");

... other stuff ...

ob_end_flush();
?>
first, there can be nothing returned before your PHP block (white space included).

Second the correct way to call that is - header("Location: {website}"); (note the capitalized Location).

Back to QA. TechInterviews.com. Powered by Yahoo! Answers and TechInterviews.com community.