Page 1 of 1

How to prevent page refresh from adding new records

Posted: Wed Oct 26, 2011 8:52 pm
by Tokunbo
hello sirs,

In-line with some earlier posts I made, I have a code that allows a user to enter a name and surnname and these get inserted into a table. This works fine, no issues.

I have observed that if I refresh my page / use the F5 button, the previous record which I entered into the input boxes gets inserted again - thus I have two rows in my table with same info. Is there a way to prevent this and make sure the user uses only the submit button?

as in even if the page is refreshed, a new record(same as before) wont be added?

please note, Im not referring to trying to add the same record twice, its just the refresh thingy.

I was thinking of sessions, but I thought its supposed to be used when a user navigates, for ex: from a page1 to page2...... In my code, im posting to the same page / just inserting records into my db

thanks
Toks

Re: How to prevent page refresh from adding new records

Posted: Wed Oct 26, 2011 9:05 pm
by Celauran

Re: How to prevent page refresh from adding new records

Posted: Wed Oct 26, 2011 9:21 pm
by Tokunbo
@celauran

thanks man, you're 2much