SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 1999
    Location
    Kuala Lumpur, Malaysia
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Prevent page refresh

    Is there a way to prevent the user from refreshing/reloading a particular page? Or any way to prevent a particular form from being posted/inserted twice? Any help is greatly appreciated.

  2. #2
    SitePoint Guru
    Join Date
    May 2004
    Location
    santa rosa, ca
    Posts
    969
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't think javascript is the way to do this. Is there a reason you don't want to take care of this on the server side?
    nondenominational, noncommercial, nonprofit,
    listener-supported, 24-hour, Christian ministry:
    Listen Live Online

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 1999
    Location
    Kuala Lumpur, Malaysia
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The reason is that I don't quite know how to do that on the server side.. It's a question posed by my friend.

    On his page, he made included a PHP scripting to insert values into a MySQL database upon the page loading. He doesn't want the data to be reinserted again if the user refreshes the page. Any way to accomplish this?

  4. #4
    SitePoint Evangelist vikrantkorde's Avatar
    Join Date
    Jun 2004
    Location
    Mumbai, India
    Posts
    541
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is no way by which you can stop reloading functionality of any page. as that is a browser function.
    When you refresh a page it is as good as you are calling a page or caaling a function with the paramenter. So everytime you refresh the page same set of parameteres are sent ot the page and page gets called. There is no way by which you can stop this.

    About the problem u r talking, that can be solved by redirection. As soon as the successful insertion is made just redirect the browser to a different page. either via JavaScript or PHP(header).
    Vikrant Korde
    S Y S T I M E, Mhape,
    Mumbai, Maharashtra, India.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •