程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> PHP編程 >> 關於PHP編程 >> php實現保存submit內容之後禁止刷新

php實現保存submit內容之後禁止刷新

編輯:關於PHP編程

     這篇文章主要介紹了php保存submit內容之後禁止刷新的具體實現,需要的朋友可以參考下

    代碼如下: $strsql = "INSERT INTO `xxx` (`aaa`) VALUES ('".$_POST["bbb"]."','".$_POST["ccc"]."',,now())";    $result=@mysql_query($strsql,$my_con);  $maxrow=@mysql_affected_rows();  Testecho ($y.mysql_affected_rows()." $errcode ".$strsql); #debug  mysql_sql_log($strsql,mysql_affected_rows(),$_SERVER['SCRIPT_NAME'].":".__LINE__);  if($maxrow>0){  $insertflag =1;  }    echo '<script>location.href="6612.php?inserted=1"</script>';    重點是最後一句,在insert完之後,重新載入一次頁面,並且加上參數,然後在頁面上寫個判斷,又GET的參數並且為1的時候disabled。   代碼如下: <?php echo $insertflag;print_r($_GET); if($_GET[inserted]!=1){?>  <input type="submit" value="新規登録" name="insertN" class="box1a"></input>  <?php }else{?>  <input type="botton" value="新規登録" name="insertN" class="box1a" disabled></input>  <?php }?>     
    1. 上一頁:
    2. 下一頁:
    Copyright © 程式師世界 All Rights Reserved