Display status of a determinate or indeterminate process.
You can use it for show processing levels.
<!-- Progress bar holder -->
<div id="progress" style="width:500px;border:1px solid #ccc;"></div>
<!-- Progress information -->
<div id="information" style="width"></div>
<?php
$total = 10000; // Total processes
for ($i = 1; $i <= $total; $i++) {
$percent = intval($i / $total * 100); // Calculate the percentation
?>
<script>
document.getElementById("progress").innerHTML ="<div style='width: <?php echo $percent; ?>%; background-color:#ddd;'> </div>";
document.getElementById("information").innerHTML ="<?php echo $i; ?> row(s) processed.";
</script>
<?php
flush(); // Send output to browser immediately
}
?>
No comments:
Post a Comment