Ok... confession time-
This question has came up on these forums a few times before.
But before everyone bites my head off, let me assure you, I've studied all of the threads in detail and so far we don't seem to be able to agree on the single best method of solving this common problem.
The problem is this... If you have a webpage with a PHP script that inserts records into a database, then the user can hit the page refresh button and every time he does so, the script adds another record into the database. This is not good.
So far, from what I've read there are several methods of dealing with this problem. A few of them are;
cookies (which I'm not into using cos some computers won't accept them),
sessions (which I admit to not knowing much about)
page redirects- so that when they submit the form they are redirected to a thanks page (but the flaw with this is that a malicious user could still use the "back" button on his browser and do a zillion database re-entries)
I'm sorry for repeating past questions, but in the light of the mass confusion that seems to be out there, I wonder if anyone could bring this all together and declare once and for all what the best method is.
My main worry is that I spend the next three days learning about sessions (or something), then I find out it's gonna be no use at all for this problem.
Thanks,
David
PS- I note with interest that this problem does not get a single mention in Sams Learn PHP in 24 hours book.