Unanswered: Refresh Button Problem while data adding
Can anybody help me? I have a problem while adding data in asp.While I add a record its adding the record to the database.But if i press the refresh button Of Internet explorer it is adding the same data again.I want to stop this.
Anybody can help me out.
Thanks in advance.
well the refresh is just repeating the last http post that was made (so if you clicked the save button to save a record you are effectively doing the same by pressing refresh.
getting rid of any caching may solve this problem but I doubt it will work on all browsers...
the best bet is to add a check so that before you save you make sure there is no record existing that is the same as what you have added (this may not help if the data you are adding has not unique identifiers).
if you make your form properly, and use some type of variable (like a session cookie) that only exists when you are submitting the form...
after you enter into the process of updating the database you clear/wipe that variable.... so then if you hit refresh, the variable no longer exists, the database does not get updated again
Providing Technology services to non profit orgs, Homeless Shelters, Food Pantries, Clean And Sober Houses and more. To date we have given away over 900 free computers !
caeli enarrant gloriam Dei !
Sorry,the way u stated doesn't make any sense.Just tell me if I create a session variable as
session("updat_ok")=true and make it false when I have done with the update ,where will I put the session(updat_ok)=true?
The checking is ok in the update.asp page but in the submit page where will u put the session(updat_ok)=true?