I am using php 5.3.6 and below is my code and it is producing an error
Warning: Cannot modify header information - headers already sent by (output started at ............
<?php
ob_implicit_flush(true);
print "<pre>";
$loop = true;
$counter = 0;
while ($loop) {
$counter++;
// some code
print "some output of code. \n";
if ($elapsedTime > 300) {
$loop = false;
print "5 minute passed and loop ended. \n";
}
}
print "</pre>";
ob_end_flush();
header("refresh:5;url=test.php" );
?>
what I wanted to do is displays contents from each loop while the loop is active. then when the loop is ended I need to flush all the previous output or header and send a new header to refresh the current page.