I have seen this in several forums before, and "think" I know the cause, but this doesn't make sense.
If I remove the Doctype declaration from a page, I don't get the error.
This page (http://example.com/test.htm) gives me the "cannot modify header" error. Code follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<?php
$sellerId = 111;
$numRows = 0;
if ($numRows == 0) {
if ($sellerId == 102) {
header("Location: http://example1.com/fleamarket.php");
} else {
header("Location: http://example.com/notfound.html");
}
}
?> But if I remove the Doctype declaration, I redirect the way it's intended.
See this page (http://example.com/test_no_doctype.htm). Code follows:
<?php
$sellerId = 111;
$numRows = 0;
if ($numRows == 0) {
if ($sellerId == 102) {
header("Location: http://example1.com/fleamarket.php");
} else {
header("Location: http://example.com/notfound.html");
}
}
?> All I have done is remove the Doctype declaration.
I'm editing this right in File Manager, so I don't think I'm adding any whitespace.
Can anyone help me with this one? THANK YOU in advance!
Steve Adams
[edited by: jatar_k at 1:41 pm (utc) on Jun 8, 2010]
[edit reason] no personal urls thanks [/edit]