progress bar through php
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div id="progress" style="width:500px;border:1px solid #ccc;"></div>
<!-- Progress information -->
<div id="information" style="width"></div>
</body>
</html>
<?php
$total=50;
for($i=0;$i<$total;$i++){
$percent = intval($i/$total * 100)."%";
echo '<script language="javascript">
document.getElementById("progress").innerHTML="<div style=\"width:'.$percent.';background-color:orange;\"> </div>";
document.getElementById("information").innerHTML="'.$i.' row(s) processed.";
</script>';
// This is for the buffer achieve the minimum size in order to flush data
echo str_repeat(' ',1024*64);
// Send output to browser immediately
flush();
// Sleep one second so we can see the delay
sleep(1);
echo '<script language="javascript">document.getElementById("information").innerHTML="Process completed"</script>';
}
?>
<html>
<head>
<title></title>
</head>
<body>
<div id="progress" style="width:500px;border:1px solid #ccc;"></div>
<!-- Progress information -->
<div id="information" style="width"></div>
</body>
</html>
<?php
$total=50;
for($i=0;$i<$total;$i++){
$percent = intval($i/$total * 100)."%";
echo '<script language="javascript">
document.getElementById("progress").innerHTML="<div style=\"width:'.$percent.';background-color:orange;\"> </div>";
document.getElementById("information").innerHTML="'.$i.' row(s) processed.";
</script>';
// This is for the buffer achieve the minimum size in order to flush data
echo str_repeat(' ',1024*64);
// Send output to browser immediately
flush();
// Sleep one second so we can see the delay
sleep(1);
echo '<script language="javascript">document.getElementById("information").innerHTML="Process completed"</script>';
}
?>
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment