Entry
Is there anyway I can display a progressbar in PHP while i'm in a loop?
Jul 29th, 2001 07:01
Jacq, j chua, http://www.sepulchre.co.uk/article.php?cat=9&index=9
Make initial html page and then flush it to the client. Use Javascript
to increase the bar....
Like this:
<html>
<head>
<title>Progress Bar</title>
</head>
<body>
<img name="pb" src="/images/gdot.gif" height="10"
width="1" />
</body>
</html>
<?
flush();
$i = 1;
while ($i < 100)
{
sleep(1); // Do some work here...
// increase the progress bar
echo "<script language=\"javascript\">";
echo "window.document.images('pb').width =
$i;</script>";
flush();
$i += 10;
}
?>