Home >Backend Development >PHP Tutorial >How to prevent PHP form from refreshing and submitting, PHP form refresh and submit_PHP tutorial
Excerpted from http://bbs.chinaunix.net/thread-667547-1-1.html
------------------------------------------------- -----------------------
When outputting the form page: (Give me an example, it’s not perfect)
$intFlag = md5(time());
$strFlag = 'flag_$intFlag';
$_SESSION["$strFlag"] = 1;
Then when accepting data:
$action_flag = trim($_POST["action_flag"]);
if ($action_flag!="" && $_SESSION["$action_flag"]==1)
{
$_SESSION["$action_flag"] = 2;
//Process data
}
else
{
die("Duplicate submission or other errors");
}