By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,636 Members | 1,181 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,636 IT Pros & Developers. It's quick & easy.

how to restrict inserting data into db while html page refreshing

P: 45
hello everyone,

i need your help.

i m using update query for a table to update data. i want to insert data when submit button is pressed but when page is refeshed the table data is automatically updated the value. now i want to restrict automatic update except submit button is pressed.

how to do it ?
can any one please help me out.

Aug 2 '08 #1
Share this Question
Share on Google+
2 Replies

P: 54

This should be done on the server side, like so:
Immediately after you insert the date, redirect the user to a third page using the HTTP "Location" header so when they refresh the page they'll get the third page and nothing happens (because the second page added the data to the database and moved on the the third).

You could also redirect the user with JavaScript on the page that loads after the form is submitted. Send them to a "thank you" page or something. You could also try to set the current url to the current url (yes, it's redundant, i know) which just causes the page to reload without doing anything so when the user refreshes, the last action will be performed by the browser: load the url without sending anything to the server.

If you don't understand, let me know and I'll post an example.

Hope this helps,
Aug 2 '08 #2

P: 45
Hello Tom

Thanks for your co-operation.If u please provide me an example,it will be more clear to me. But one thing i need to call the self page agian.

Aug 3 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.