I have a function that imports a files contents into mySQL and returns the results. If i refresh the page and click “yes” it will do it again doubling the output with the same content.
How can I stop this happening? In this particular case there is no URI in the address bar but on other functions there is.
You should just check if the contents in the database exist, if they don’t, fill them. Otherwise don’t run the function.
psuedo-code:
On top of this, it is always good practice to redirect after a POST request. So you would want: