Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- Preventing Double submit on refresh/back


Marked - 9:57 am on May 15, 2010 (gmt 0)


Thanks for all your replies :)

For my script there is no need for an error message system, because I use javascript to ensure the form is filled out correctly.

Ok, what I did was create this function:
function doRedirect($url)
{
header('Location: '.$url);
}

And then:
if(isset($_POST['hidden_field']))
{
//run code

doRedirect($_SERVER['REQUEST_URI']);
exit();

}


It works pretty well. However does not work when the user tries to go back. At the moment though I'm pretty satsified with this system. :)


Thread source:: http://www.webmasterworld.com/php/4131929.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com