[eluser]Rick Jolly[/eluser]
[quote author="Pygon" date="1193793541"]If dup on f5 is the only concern, why not just:
Code:
if( empty($_SESSION['submitted']) )
{
//process form.
$_SESSION['submitted'] = 1;
} else {
//Ignore submit
}
I see absolutely no reason to waste DB queries on this.[/quote]
Depending on your needs, that would work. However, what if a user wanted to submit the same form with different data? The first example that comes to mind: an admin user inputting a number of users with the same form. Using your code, that wouldn't be possible. The unique token elimnates duplicate submissions from cached form input. In addition, with the token you wouldn't have to use the session - although you could.