SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast sangharsha's Avatar
    Join Date
    Mar 2005
    Location
    Kathmandu, Oklahoma, New Delhi
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Page resubmitting problem

    I have a series of pages that contain forms and each page submits data to the next one. But in the middle of the process, when the user clicks "Back" button, it displays "Warningage has expired" message. and I need to refresh the page. is there any idea how to resubmit the page or any other suggestions.

  2. #2
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    Australia
    Posts
    84
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    One way to do it is to use GET instead of POST.

    Another way is to use sessions and redirect the user after the post. Actually this might prevent them from clicking back. Either way the user really shouldn't be doing it.

    If you do use sessions properly. ie putting all the POSTed info in a session then coding a back or previous button would be much easier.

    I did a quick search on google which you should try too and came up with this:

    header("Cache-control: private");

    Put it at the top of each PHP page before output and see what it does.

  3. #3
    SitePoint Wizard Dangermouse's Avatar
    Join Date
    Oct 2003
    Posts
    1,024
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  4. #4
    SitePoint Enthusiast sangharsha's Avatar
    Join Date
    Mar 2005
    Location
    Kathmandu, Oklahoma, New Delhi
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thank you very much!!!

    Hey this code worked out. It seems to have solved the problem, please tell me if there are any side effects from this.

    header("Cache-control: private");

    Thanks again.
    Quote Originally Posted by ultk
    One way to do it is to use GET instead of POST.


  5. #5
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What I do is the page that responds to the form submission, the page in the forms 'action' for a better description, puts $_POST to a session variable and redirects to another page where I validate the form data, insert/update to database, etc etc

    This way you'll not get the refresh problem, but the current script I have is messy, too embarrassed to post an example

  6. #6
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Moved to a more appropriate forum. See Where should I post my thread? for details

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature


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
  •