PHP不断刷新 [英] PHP keeps Inserting on refreshing
问题描述
我目前正在为一个学校项目编程一个网站,在该网站中我必须组织每日的日程安排/报告.
I am currently programming a website for a school project in which I have to organize daily schedules/reports.
以下情况: 我将以下内容插入PHP:
Following Situation: I am inserting the following into PHP:
$sqlinserttb = "INSERT INTO tagesberichte (`TbID`, `Tagesberichte`, `Datum`) VALUES ('DEFAULT', '".$tagesbericht."', '".$datum."');";
如果提交已被命中,则将其插入. 问题是当我按F5键或手动刷新浏览器时,页面会使用最后一次使用的输入再次将其插入.
If submit has been hit, it inserts it. The problem is when I press F5 or manually refresh the browser, the page inserts it again with the last used inputs.
我想念什么?
推荐答案
插入完成后使用header("location: <path to your self-submitting form>");
,这样将显示新表单,并且刷新不会导致再次提交.
Use header("location: <path to your self-submitting form>");
after you are done inserting, that way a fresh form will be displayed and refreshing should not lead to submitting again.
这篇关于PHP不断刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!