Noob Noob - 4 months ago 17x
PHP Question

php function to refresh page with requested time

So there is a page which needs to refresh as per a user want to.

Now if they want to refresh the page for ten times, what they should do rather than reload the page?

I want something like

$refresh=[no. of time requested]

How to do that ?


You can send a Refresh header to tell the page to refresh. Subtract 1 from the number of refreshes so it will count down.

if (isset($_GET['refresh']) && int($_GET['refresh']) > 1) {
    header("Refresh: $refresh_seconds; {$_GET['refresh']}");

where $refresh_seconds is how many seconds it should wait before refreshing.