Reputation: 91
i posted delay loading with php but everybody said this is difficult
and it better using jquery.
anyone give me some hint or reference?
i want to make my php page delay loading with some image(loading image)
such like
http://www.businessbee.com/wp-content/uploads/24534/loading_home.gif
i have 3 php page
from first page if click submit button, next page is loading.php page which
display loading image and 30sec later i want to redirect to
third page final.php.
redirection and delay function is no problem , problem is
when start to delay loading image is not showing..
i want loading image show to user while delay 30sec
<?php
$delaytime=30;
for ($x=0; $x<$delaytime; $x++) {
echo " ";
sleep(1);
}
header("Location: /final.php"); /* Redirect browser */
exit();
?>
Upvotes: 0
Views: 582
Reputation: 324810
Your loading.php
page should just be:
<img src="loading_image_here.gif" />
<a href="final.php">Click here if the browser does not redirect you</a>
<script type="text/javascript">
setTimeout(function() {
location.href = "final.php";
},30000); // 30 seconds
</script>
Note that most people probably won't want to wait 30 seconds unless there's a damn good reason...
Upvotes: 1