Reply to Cannot modify header information - headers already sent by

Your name:

Reply:


Posted by maya on 06/22/06 21:33

yes I know, this has been asked many times, but I don't quite the
answers: usu. answers are to put the redirect code -- in my case

$URL =
"out.php?msg=selected+records+have+been+deleted+from+the+database.";
header("Location: $URL");

BEFORE any HTML output (does this include 'echo' output's?)

but: if, like in my case, for example, I delete data (passed in req)
from db THEN I redirect pg back to referer, how can I put redirect code
BEFORE anything else? I have to do db stuff, disconnect from db, THEN
do the redirect.. this is my code at then of file in question:

<html><head>css.. etc.. </head><body>
php: do db stuff... then:
mysql_close($conn);
echo "<br><br><b>connection to db closed.</b><br><br><br>\n\n";
$URL = "out.php?msg=selected+records+have+been+deleted+from+the+database.";
header("Location: $URL");
?>
</body>
</html>

(this is not a serious problem since can do with JavaScript, but just
wondering what the deal is here... in Java you do redirect with RESPONSE
object, and you can put redirect code wherever you want.. I don't quite
understand why this is a problem in PHP..)
(does $_RESPONSE exist in PHP? I looked here,
http://us3.php.net/reserved.variables.. I see $_REQUEST, but not
$_RESPONSE..

thank you very much..

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация