How do I disable refresh?

  • jshaulis
  • Student
  • Student
  • No Avatar
  • Joined: May 05, 2004
  • Posts: 70
  • Status: Offline

Post June 28th, 2004, 10:08 am

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
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post June 28th, 2004, 10:08 am

  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Joined: May 28, 2003
  • Posts: 23404
  • Loc: Woodbridge VA
  • Status: Offline

Post June 28th, 2004, 10:31 am

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
"There's no place like 127.0.0.1 except for ::1."
Alexandria Networks. Leader in IT consulting for associations/non-profits, and small to medium sized businesses around the northern Virginia and Washington D.C. metro area.
  • rtm223
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Mar 24, 2004
  • Posts: 1855
  • Loc: Uk
  • Status: Offline

Post June 28th, 2004, 10:44 am

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?
CSS website design tutorials
  • Rabid Dog
  • Web Master
  • Web Master
  • User avatar
  • Joined: May 21, 2004
  • Posts: 3229
  • Loc: South Africa
  • Status: Offline

Post June 29th, 2004, 3:30 am

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
Watch me grow
  • jshaulis
  • Student
  • Student
  • No Avatar
  • Joined: May 05, 2004
  • Posts: 70
  • Status: Offline

Post June 29th, 2004, 4:48 am

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 153 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
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.