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

php解决表单重复提交问题

PHP中文网
Release: 2016-05-25 17:09:37
Original
1089 people have browsed it

[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;;
  }
 } 
?>
Copy after login

                   

                   

Related labels:
php
source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template