Greetings, I wasn't sure if this should be in the php area or the database area, but I thought I'd try here first....
I have a page (say, page 1) that on loading, queries a value out of a database, which can be either 'on' or 'off'.
If the database retrieves 'on' it runs a specific block of code, and then updates the database entry to 'off'.
From that page, a user can click on a link that goes to another page (say, page 2).
The problem is, if the user hits the back button to go back to page 1, the page executes the 'on' block of code that shouldn't be executed (as the database value is now set to 'off').
I'm guessing it is because the page isn't actually being reloaded. I fixed the problem by adding some headers to page 1:
header( "Expires: Mon, 20 Dec 1998 01:00:00 GMT" );
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
header( "Cache-Control: no-cache, must-revalidate" );
header( "Pragma: no-cache" );
This solves the problem, but then, for some reason, when a user clicks a link taking them to 'page 1', the page takes a REALLY LONG time to load (beyond the normal time for 'reloading the entire page because of no cache.'). If I remove the headers, this problem goes away, but the previously described back button problem returns....
Is there any way to fix this? I'm trying to stay away from using sessions if that is an option...
Thanks in advance for your help.