1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

how to prevent the form submit it values when i press the refresh button

Discussion in 'PHP' started by darkbernz, Jan 28, 2011.

  1. darkbernz

    darkbernz New Member

    Joined:
    Dec 11, 2010
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    none
    Location:
    Philippines
    after i submit the form. i noticed that when i refresh the page that says for example "data inserted successfully", the data or information are being submitted again. It inserts the same information from the form to into my database.
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    What else you expect when you refresh it?
     
  3. darkbernz

    darkbernz New Member

    Joined:
    Dec 11, 2010
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    none
    Location:
    Philippines
    i want to show you a page that describes my probem,but an error occurs when paste the URL here.
    this is the URL
    h1.ripway.com/darkbernz/PROBLEM.html
     
  4. darkbernz

    darkbernz New Member

    Joined:
    Dec 11, 2010
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    none
    Location:
    Philippines
    i created that page to describe whats happening.. thanks
     
  5. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    So you mean to say you want user to show that instead of it is coming. I got that wrongly.

    You have to submit the form to page where you insert the data in database and then show the message to the user. :)
     
  6. darkbernz

    darkbernz New Member

    Joined:
    Dec 11, 2010
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    none
    Location:
    Philippines
    if a user submitted the form and the user accidentally refreshed the page, it will insert the user's information twice to the database.

    you mean redirect the page after the submit button was clicked?
     
  7. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    Refresh button if you don't want user to be inserting the data once again you can use the username as unique so it will give you error.
     
  8. seoabhisek

    seoabhisek Banned

    Joined:
    Jan 22, 2011
    Messages:
    24
    Likes Received:
    1
    Trophy Points:
    0
    actually refresh words technical meaning is to save all the informations carefully as per refres is working
     
  9. ManzZup

    ManzZup New Member

    Joined:
    May 9, 2009
    Messages:
    278
    Likes Received:
    43
    Trophy Points:
    0
    Occupation:
    Production Manager:Software @ ZONTEK
    Location:
    Sri Lanka
    Home Page:
    u gt 'some' options
    either use AJAX so the refresh doznt matter at all
    or put the script in another page, i mean when data is submitted, the user is redirected to another page or redirected to the same page
     

Share This Page