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 How to add Read More Read Less Button using JavaScript? #3 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #4 Solution to the error “Visual Studio Code can’t be opened because Apple cannot check it for malicious software” #5 How to uninstall Cocoapods from the Mac OS? #6 PHP Login System using PDO Part 1: Create User Registration Page

Recently Posted

#Apr 8 JSON.stringify() in JavaScript #Apr 7 Middleware in NextJS #Jan 17 4 advanced ways to search Colleague #Jan 16 Colleague UI Basics: The Search Area #Jan 16 Colleague UI Basics: The Context Area #Jan 16 Colleague UI Basics: Accessing the user interface
You might also like these
$this Keyword in PHPPHPContent Blocks in SCSS (Sass)SCSSSolution for “Yarn build: Failed because of a stylelint error”WordPressUseful (and probably ignored) HTML tags: Part 2HTMLReview an intentionally vulnerable plugin in WordPressWordPress@use rule in SCSS (Sass)SCSSLearn to create your skill bar using CSSCSSFull and Partial ROLLUP in Postgresql with ExamplesPostgresHow to link/add CSS file to HTML Document?CSSHow to modify AutoSave Interval using code in WordPress?WordPressHow to add Date and Time picker in HTML and get the values using JavaScript?HTMLthe box-sizing property in CSSCSS