PHP Progress Indicator

 

The following script is useful for displaying progress, in percentage. It can be used in a page preloading situation, as displayed below or many other types of situations such as image preloading, file uploading etc.

Please edit to your needs, but support this site and leave the © information in place.

 

 

Example

Please wait, page loading.....  6 % 12 % 18 % 24 % 29 % 35 % 41 % 47 % 53 % 59 % 65 % 71 % 76 % 82 % 88 % 94 % 100 %

Page load now complete!

 

Script Source

 

<The CSS >

<style type="text/css">
<!--
.box {
background-color: #ffffff;
position: absolute;
font-family: "Arial", Tahoma;
color: #990033;
}
-->
</style>

 

<The PHP Script >

 

Please wait, page loading.....&nbsp;
<?php

// +++++++++++++++++++++++++++++++++++
// + Script by www.wizzardweb.co.uk
// + Copyright 2016
// + Pleas do not remove this information
// +++++++++++++++++++++++++++++++++++

flush();

$loop = "17";

$p_per_loop = 100 / $loop;

$p_last = 0;

$loop = "17";

for($i=1;$i<=$loop;$i++) {

sleep(1);

$p_now = round($i * $p_per_loop);
if($p_now != $p_last) {
?>
<span class="box">
<?php echo $p_now; ?> %</span>
<?php
$diff = $p_now - $p_last;
for($j=1;$j<=$diff;$j++) {
}
$p_last = $p_now;
}
flush();
}
?>
<p>
<?php

echo "Page load now complete!";
?>

 

Please let me know if this script was helpful to you.

[rating]