How do I disable refresh?

  • jshaulis
  • Student
  • Student
  • jshaulis
  • Posts: 70

Post 3+ Months Ago

Hello everyone,

I have a page that uses php and mysql to submit information. Now once the information is submitted I do not want the user to click refresh. The reason why, is it will submit the information again and again. Is there a way to do this? Thanks in advance,

Justin
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23460
  • Loc: Woodbridge VA

Post 3+ Months Ago

I don't think there's a sure-fire way to prevent it, but perhaps these two links will help:

http://www.ozzu.com/programming-forum/stop-refresh-t23293.html&hi ... sable+back

http://www.planet-source-code.com/vb/sc ... 0&lngWId=2
  • rtm223
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1855
  • Loc: Uk

Post 3+ Months Ago

An error 301 perhaps? If the form is valid, then action is carried out, and the browser is fed a 301, directing to a "thank you" type page. If the form is invalid then you DON'T send the 301 and reload the form.

Any takers for this idea? Will it work?
  • Rabid Dog
  • Web Master
  • Web Master
  • User avatar
  • Posts: 3245
  • Loc: South Africa

Post 3+ Months Ago

Simialar to what rtm thinks.

I would have the page submit the info, validate the data and on successfully completion of the transaction redirect to another page.

Another option is make one of the fields unique in the DB, so that if there is a refresh it will generate an SQL error and not insert the data. Then you could display a kind error saying the information has already been submitted and entered successfully.

It is not a good idea to disable things in the browser. Users will generally take this as an error with the browser and close the window and restart the browser
  • jshaulis
  • Student
  • Student
  • jshaulis
  • Posts: 70

Post 3+ Months Ago

Alrighty, I think I will use the redirect idea. Thanks a lot guys.

Justin

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 12 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.