Yogesh Chauhan's Blog

How to refresh a page using PHP at regularly occurring intervals?

in PHP on February 21, 2020

I use the following:


It refreshes the current page after some code executes(or not, your choice)

Also, if you need to redirect it to another page, we can add the target page as following:

header("Refresh:0; url=another_page.php");

It is not advisable to use it unless there is no other option as that 0 will continuously call server and update your local cache as well. If you use 3-4, it will refresh the page every 3-4 seconds.

Many times, if you want to use it with JavaScript alert, it doesn't work or the alert doesn't show up properly. Alternately, we can use JavaScript method as well, like:


The reload() method is used to reload the current document. The reload() method does the same as the reload button in your browser.

Most Read

#1 How to check if radio button is checked or not using JavaScript? #2 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #3 How to add Read More Read Less Button using JavaScript? #4 How to uninstall Cocoapods from the Mac OS? #5 PHP Login System using PDO Part 1: Create User Registration Page #6 How to Use SQL MAX() Function with Dates?

Recently Posted

#Aug 15 Is PHP still good for back-end programming? #Aug 10 How to create a multisite network in WordPress? #Aug 3 How to create a circle that follows a cursor using JavaScript and CSS? #Aug 3 How to make a curtain slider using jQuery and CSS? #Aug 2 How to progressively load images and add a blurry placeholder? #Aug 1 How to create a placeholder loader (throbber) using CSS?
You might also like these
Ampersand (Parent Selector) in SCSS (Sass)SCSSWhat’s the difference between visibility: hidden and display: none?CSSThe SQL EXISTS OperatorSQL/MySQLThe basics of CSS Box modelCSSHow to get recent posts in WordPress?WordPressAccessing and Setting features of JavaScript ObjectsJavaScriptHow to create a vertically rotating texts using CSS?CSSHow to catch .keypress() on body using jQuery?jQueryWordPress: How to loop through a repeater field in ACF?WordPressThe Difference Between the echo and print Commands in PHPPHPWhen you don’t want to @forward every member in SCSS (Sass)SCSSHow to create a for loop in SCSS (Sass)?SCSS