page refresh

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
navid
Forum Commoner
Posts: 68
Joined: Tue Sep 24, 2002 3:14 am
Location: iran

page refresh

Post by navid »

hello everybody

how can distingush page was refreshed by php ?
Ihave a form. information in form insert to database when the form was submited.
but I have a problem , every time that page was refreshed the data was insert in DB so the data insert to DB More than once.
amir
Forum Contributor
Posts: 287
Joined: Sat Oct 07, 2006 4:28 pm

Post by amir »

Please post your code so that we could have a look!
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Here's a pretty simple solution: add a unique id to each form that you generate.. this way you can keep track exactly which form has been posted back.. and decide whether or not you're still accepting the values... (in order to prevent users tampering this 'unique id' i'd advise to keep a link between the id and the user... this way they can only mess with theirselves ;))
Post Reply