PHP Tutorial : Function To Refresh a Page

Well,

This php function uses the html meta tag and its refresh attribute. I use it because I can easily estabilish how many seconds to wait before refreshing the page : nice, isn’t it?

There is already a php function which refreshes a page, but there isn’t a way to pass the number of seconds needed before refreshes, it’s just refreshes the page when the php engine goes to the line of code.

Here is the function :

<?php
//function to refresh a page in a number of seconds

function refreshPage($destination, $seconds)
{

print "<meta http-equiv=\"refresh\" content=\"$seconds; url=$destination\">";
}
?>
This entry was posted in Short PHP Functions and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>