<div class="codetitle"> <span><a style="CURSOR: pointer" data="7317" class="copybut" id="copybut7317" onclick="doCopy('code7317')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code7317"> <br>$strsql = "INSERT INTO `xxx` (`aaa`) VALUES ('".$_POST["bbb"]."','".$_POST["ccc"]."',,now())"; <br><br>$result=@mysql_query($strsql,$my_con); <br>$maxrow=@mysql_affected_rows(); <br>Testecho ($y.mysql_affected_rows()." $errcode ".$strsql); #debug <br>mysql_sql_log($strsql,mysql_affected_rows(),$_SERVER['SCRIPT_NAME'].":".__LINE__); <br>if($maxrow>0){ <br>$insertflag =1; <br>} <br><br>echo '<script>location.href="6612.php?inserted=1"</script>'; <br> </div> <br>重点是最后一句,在insert完之后,重新载入一次页面,并且加上参数,然后在页面上写个判断,又GET的参数并且为1的时候disabled。 <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="99031" class="copybut" id="copybut99031" onclick="doCopy('code99031')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code99031"> <br><?php echo $insertflag;print_r($_GET); if($_GET[inserted]!=1){?> <br><input type="submit" value="新規登録" name="insertN" class="box1a"> <br><?php }else{?> <br><input type="botton" value="新規登録" name="insertN" class="box1a" disabled> <br><?php }?> <br> </div>