5

I have numbers of pages with data . I want to show that next page of current page automatically in 10 sec and now i have 2 link for next and back. But i want to show it automatically. If the page count comes to last page then it will show 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
  • use ajax to achieve such result Commented Nov 26, 2015 at 6:16
  • i have not such idea about ajax Commented Nov 26, 2015 at 6:21
  • please share your html where you are displaying record Commented Nov 26, 2015 at 6:23
  • Can i show it by loop with sleep() Commented Nov 26, 2015 at 6:28
  • yes, but that won't have the result you would like to Commented Nov 26, 2015 at 8:30

3 Answers 3

2

You can do via <meta> http-equiv Attribute as below augment content with time and next page URL

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

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

JSFifddle

Sign up to request clarification or add additional context in comments.

2 Comments

Interesting! He would need to do something like: <meta http-equiv="refresh" content="10;http://www.example.com/page.php?nextPageId=2"> and for each new page set nextPageId to the next page.
thanks Ramratan Gupta and CodeiSir ... this is exact answer ....i only copy and paste it....
1

You can't do this on the server side*. Use JavaScript: timeouts and Ajax in the Webpage to pull new content.

Searching for these Keywords will take you to a tons of examples and tutorials each.

(*) or at least it is very complicated

Comments

1

setTimeout will help you to execute any javascript code based on time you set.

syntax

setTimeout(code,millisec,lang)

Usage,

setTimeout(nextPageFunction,10000);

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

Inside function you can do something like this

document.getElementById("NextPageButton").click();

3 Comments

Don't use string in setTimout, It's eval 😏 Use an inline function or just the name of a function.
@CodeiSir I didn't quite get you. Can you please enlighten me elaborately
@CodeiSir Understood and Rectified.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.