View Single Post
Old 02-28-2008, 10:55 PM   #6 (permalink)
Alan @ CIT
Member of the Month
The Frequenter
Member of the Month Top Contributor 
 
Alan @ CIT's Avatar
 
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
Alan @ CIT is on a distinguished road
Default

That's a common problem unfortunately, Web browsers aren't smart enough to know that you have already submitted the form so it submits it again.

There are 2 ways you can get around the problem, the first is to redirect the visitor to another page directly after your INSERT query. If they then refresh the page it doesn't matter as it's a different page. You could probably also redirect the user (using header()) to the same page they are on - this would also resolve the problem.

The second option is to do a quick SELECT query before you do your INSERT query to see if the record has already been inserted - if it has, skip the insert query.

Alan
Send a message via MSN to Alan @ CIT
Alan @ CIT is offline  
Reply With Quote