Entry
How can I prevent re-"post"-ing data when a user returns to a posted page using the back button?
Feb 19th, 2008 22:06
dman, PHP Man, Leif Gregory, Petar Pavlovic, John Ehrlinger, http://www.ttnr.org
This answer is related to PHP4 sessions, but it can be used without
sessions as well
// Here we check to see if it was a "POST"
// form submit and allow caching so the
// back button won't give page expired
// These headers must be sent after the
// start_session() call on the page
if ($REQUEST_METHOD=='POST')
{
header('Expires: ' . gmdate("D, d M Y H:i:s", time()+1000) . '
GMT');
header('Cache-Control: Private');
}
coyote
-----
If you have REGISTER_GLOBALS disabled, you'll need to use
$_SERVER['REQUEST_METHOD'] instead of $REQUEST_METHOD.
Leif Gregory
====
devx.com/tips/Tip/13761