Preventing "Are you sure you want to resend POST data?" warnings

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kiran Vidhate
    New Member
    • Aug 2007
    • 1

    Preventing "Are you sure you want to resend POST data?" warnings

    Hi

    I need small help,

    What I need is when I write a script to handle my post data on my login page. if login failed and i press refresh key browser shows msg to resend the post data

    I tried unset() function too, But it didn't work. Do any one have
    anything for me ?

    Thanks In advance
    Regards
    Kaushal
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, Kaushal. Welcome to TSDN!

    You posted this in the Articles section. I'll go ahead and move it to the Forum where an Expert will be more likely to find it.

    Changed thread title to better describe the problem (did you know that threads whose titles that do not follow the Posting Guidelines actually get FEWER responses?).

    Comment

    • Purple
      Recognized Expert Contributor
      • May 2007
      • 404

      #3
      Hi kiran Vidhate,

      can you post the code you have already, it will make it simpler to assist if we can see what you have already.

      Regards Purple

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Heya, Kaushal.

        The way to prevent this is to use header() redirection. When the User submits the form, have the form submit to a *separate* page, and then use header() redirection to send him back when you are done.

        How header() redirection works

        Comment

        • entertainmentliveuk
          New Member
          • Aug 2007
          • 9

          #5
          Originally posted by kiran Vidhate
          Hi

          I need small help,

          What I need is when I write a script to handle my post data on my login page. if login failed and i press refresh key browser shows msg to resend the post data

          I tried unset() function too, But it didn't work. Do any one have
          anything for me ?

          Thanks In advance
          Regards
          Kaushal
          At the top of the page, after you have processed the data, try this:

          [code=php]
          <?php
          session_start() ;
          if(isset($_REQU EST['bla']))
          {
          process the code here, then...
          echo "<script>
          document.locati on.href='thispa ge.url';
          </script>";
          exit;
          }
          ?>
          [/code]

          This will process the data, then redirect the user to the same page, without the posted data.
          Last edited by Atli; Aug 23 '07, 12:18 PM. Reason: Added code tags

          Comment

          • Atli
            Recognized Expert Expert
            • Nov 2006
            • 5062

            #6
            Originally posted by entertainmentli veuk
            At the top of the page, after you have processed the data, try this:

            [code=php]
            <?php
            session_start() ;
            if(isset($_REQU EST['bla']))
            {
            process the code here, then...
            echo "<script>
            document.locati on.href='thispa ge.url';
            </script>";
            exit;
            }
            ?>
            [/code]

            This will process the data, then redirect the user to the same page, without the posted data.
            You can also swap the JavaScript with a header, like pbmods said.
            Like so:
            [code=php]
            header("Locatio n: thispage.url");
            [/code]

            Comment

            • entertainmentliveuk
              New Member
              • Aug 2007
              • 9

              #7
              Originally posted by Atli
              You can also swap the JavaScript with a header, like pbmods said.
              Like so:
              [code=php]
              header("Locatio n: thispage.url");
              [/code]
              Oooh I like that one... I have not found that!
              I'll try it out on my site.

              Comment

              Working...