Forum Moderators: coopster
However, the problem occurs when user then clicks Refresh, on the contact list page, and the page refreshes and a duplicate contact is created.
How would I resolve this.
Thanks for your help.
Then immediately after the DB connection I unset($add); This way, unless the user actually submits the form again, there can be no duplication, because there is no $add...
You can also unset($all,$your,$other,$variables); so there is no chance of a duplicate, unless the person fills out the form again.
Justin
;)
Appearantly, early this AM while I was typing I forgot to cover that...
I usually put my connections at the top of the page, after the connection and the unset() if you choose to use it, you can easily reload the page (or any other) using:
header("Location: http://fullurl.com/your/troubled/page.php");
which will reload the page as a new request, and you should be fine... even if your connection is on the results page, because the variables will be unset and the page request will be sent as new to the server - like highlighting the URL in the browser bar and clicking return - reloads the page, but does not refresh the page.
Hope these help a little, like I said late last night and haven't had coffee yet today - ugly combination. They should at least give you an idea.
Justin
These pages are coded using the Fusebox methodology. What happens is from the Add Contact page, on click of Add button, the page does validation and inserts into the database. If teh insert went ok, then it loads the List View. The script for List View is very simple, which is just a plain read of the database, with no updates or inserts.
For some reason, when users click Refresh after they have added a new contact record and then brought back to List View, all the scripts which were executed after on click of Add button is re-executed.