Pre Exam Test Practice (SSC | Banking | IAS | GATE | State Level | CLAT | Railways | Insurance | Teaching Exams | NDA | Defence | IES |State Exam )

Organizational Research By

Surprising Reserch Topic

how to force page not to be cached in php using -'php'

how to force page not to be cached in php  using -'php'

I have a page, index.php, that shows information based on a mysql db.  There are forms on it, and the action for the forms is set to a separate page called process.php.  Process.php does all the database CRUD stuff, then uses

header("Location: /webadmin/email/index.php");

to send the user back to the original page.

This seems to be working fine, except for the fact that the original index page doesn't always reflect the changes made by process.php.  I assume that the page is being cached, because if I do a refresh (Ctrl + F5), the page will show the latest data.

How can I prevent this page from being cached?  I have tried what the PHP page for header() says, but it doesn't seem to work.  The Cache-Control and Expires options seem to have no effect at all - the page is still being cached.


Ok, I was partially wrong.  Apparently, the following does work in IE:

<?php header("Cache-Control: no-cache, must-revalidate");

However, it is definitely NOT working in FF, which is still showing a cached version.  Any ideas on why this is, and how I can make it stop caching?

asked Sep 7, 2015 by rajesh
0 votes

Related Hot Questions

Government Jobs Opening