Posted by J.O. Aho on 09/28/25 11:42
rcross@gmail.com wrote:
> If anyone refreshes the page AFTER data has been submitted, a duplicate
> entry is created in the database. I believe that the problem is in the
> $_POST['submit'] object itself.
Due "HTTP" standards data is resent on refresh and has nothing with how PHP works.
> I know I'm not doing anything
> incorrect regarding normal field submission, so maybe it's just in the
> way I'm asking PHP handle the POST data? Is there a trick to have the
> script not re-submit the data if the data was already submitted once?
You can create a temporary cookie that you use to check if the data has
already been processed once. You can make so the "form page" removes the
cookie, and in this way eliminate the risk that new data is denied.
//Aho
Navigation:
[Reply to this message]
|