Home >php教程 >PHP源码 >php解决表单重复提交问题

php解决表单重复提交问题

PHP中文网
PHP中文网Original
2016-05-25 17:09:371085browse

[PHP]代码  

<?php
 session_start();
 $_SESSION[&#39;num&#39;] = 0;
 if(isset($_POST[&#39;action&#39;] && $_POST[&#39;action&#39;]==&#39;submit&#39;)){
  if($_SESSION[&#39;num&#39;] == 0){
   echo &#39;<a href="&#39;.$_SERVER[&#39;PHP_SELF&#39;].&#39;">&#39;请再次尝试</a>;&#39;
   $_SESSION[&#39;num&#39;] = 1;
  }else{
   echo &#39;您已经提交过了,请不要重复提交&#39;;
  }
 } 
?>

                   

                   

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