表单信息重复提交的问题。 不太明白,在 PHP 里,提交表单后,数据会自动清空,目前只有 ASP.NET 的 ViewState 有保留数据的功能. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <?if( $_POST ){ print_r($_POST); echo "<script> location.href='".$PHP_SELF."';</script>";}?>这样子就不会了。。你刚提交,再刷新就会提交原来的内容了。。 echo "<script> location.href='".$PHP_SELF."';</script>";是什么意思啊? 其中的$PHP_SELF就是当前页的地址 格式如:http://localhost/youpage.php 偶一般提交到隐藏iframe里面,处理完成后刷新整个窗口 把SQL执行页面和form提交页面分开。提交后,返回form页面。这样按F5刷新是不能重复提交的。<html><body><form method="post" action=save.php><table border="0"><tr> <th align="right">Employee ID</th> <td><input name="emp_id" type="text" maxlength="8" size="24"></tr><tr> <th align="right">Employee Email</th> <td><input name="emp_email" type="text" maxlength="40" size="24"></tr><td> <input type="submit" name="submit" value="Add New Employee" /></td></table></form>------------------save.php<?php echo $_POST ['emp_id']; echo $_POST ['emp_email'];?>执行数据保存,成功后,返回form页面</body><html> cailinzheng(阿卡) 你的思路非常好,谢谢. php关于博客中日志修改问题 Warning: rename(./新建文本文档11.txt,./新建文本文档111.txt) [function.rename]: Permission de 希望各位 php 高手帮我下啊 谢谢了 人民币求做一个列表样式 请教:关于时间的处理问题 如何读出文件夹下的所有文件名 报告! 怎样获得一个出生日期最小的人的名字 求救!还是session问题 那里的whois server最快啊! 有没有碰到过这种现象,网站一会儿快一会儿慢? 高分,求一小问题!!!
if( $_POST ){
print_r($_POST);
echo "<script> location.href='".$PHP_SELF."';</script>";
}
?>
这样子就不会了。。
你刚提交,再刷新就会提交原来的内容了。。
是什么意思啊?
<body>
<form method="post" action=save.php>
<table border="0">
<tr>
<th align="right">Employee ID</th>
<td><input name="emp_id" type="text" maxlength="8" size="24">
</tr>
<tr>
<th align="right">Employee Email</th>
<td><input name="emp_email" type="text" maxlength="40" size="24">
</tr>
<td>
<input type="submit" name="submit" value="Add New Employee" />
</td>
</table>
</form>
------------------
save.php
<?php
echo $_POST ['emp_id'];
echo $_POST ['emp_email'];
?>
执行数据保存,成功后,返回form页面
</body>
<html>
你的思路非常好,谢谢.