Home  >  Article  >  Backend Development  >  How to prevent PHP form from refreshing and submitting, PHP form refresh and submit_PHP tutorial

How to prevent PHP form from refreshing and submitting, PHP form refresh and submit_PHP tutorial

WBOY
WBOYOriginal
2016-07-12 09:05:19849browse

How to prevent refresh submission of PHP form, PHP form refresh submission

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");
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1069671.htmlTechArticleHow to prevent refresh submission of PHP form, PHP form refresh submission is taken from http://bbs.chinaunix.net/thread -667547-1-1.html ------------------------------------------------ -----------------------...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn