How to automatically display the next page in a certain time (10 seconds) in php?

I have a number of data pages. I want to show this next page of the current page automatically after 10 seconds, and now I have 2 links for the next and vice versa. But I want to show it automatically. If the number of pages falls on the last page, it displays the first page.

for ($counterstart=$startcounter ; $counterstart<=count($device)-1;$counterstart++){ $entry = $device[$counterstart] ; echo "page"; } if ($startcounter ==$result ){ echo " Back "; }else{ echo "Next"; } 
+5
source share
3 answers

You can execute the http-equiv attribute via <meta> , as shown below, with the contents and URL of the next page

 <head> <meta http-equiv="refresh" content="10;http://www.metatags.info/meta_http_equiv"> </head> 

Link - http://www.metatags.info/meta_http_equiv

Jsfifddle

+3
source

You cannot do this on the server side *. Use JavaScript: timeouts and Ajax on a web page to pull new content.

Searching for these keywords will lead you to many examples and tutorials.

(*) or at least very difficult

+1
source

setTimeout helps you execute any javascript code based on the time you set.

syntax

 setTimeout(code,millisec,lang) 

Using

 setTimeout(nextPageFunction,10000); 

More details, http://www.w3schools.com/jsref/met_win_settimeout.asp

Inside the function you can do something like this

 document.getElementById("NextPageButton").click(); 
+1
source

Source: https://habr.com/ru/post/1236875/


All Articles