So as the title says i want to prevent user from keep submiting $_POST data to my database.
Now what i have is form and simple class for submiting form data to my database. The problem is that if user submits data and refreshes browser it would submit same data again.
I know i could refresh page by my self with meta or by using headers, but i don’t wanna do something so stupid, so i guess i could just do something like $_POST = null; not sure if that works but i actualy wanna keep all post data because if some errors appears i want to populate my form with previous post data…
Anyways i hope you guys get what i wanna do here and can help me a little 😀
The simple solution is you should redirect users after form submission and procession on that data.
You could make a check if the data is successfully submitted and processed redirect users otherwise don’t redirect them this can keep
$_POSTdata to re-populate fields.This will prevent re-submission of form.
General Pseudocode