424,279 Members | 1,907 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,279 IT Pros & Developers. It's quick & easy.

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

P: 1
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
Aug 21 '07 #1
Share this Question
Share on Google+
6 Replies


pbmods
Expert 5K+
P: 5,821
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?).
Aug 21 '07 #2

Purple
Expert 100+
P: 404
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
Aug 22 '07 #3

pbmods
Expert 5K+
P: 5,821
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
Aug 22 '07 #4

entertainmentliveuk
P: 9
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:

Expand|Select|Wrap|Line Numbers
  1. <?php 
  2. session_start();
  3.    if(isset($_REQUEST['bla']))
  4.       {
  5.           process the code here, then...
  6.          echo "<script>
  7.                   document.location.href='thispage.url';
  8.                   </script>";
  9.          exit;
  10.       }
  11. ?>
  12.  
This will process the data, then redirect the user to the same page, without the posted data.
Aug 23 '07 #5

Atli
Expert 5K+
P: 5,058
At the top of the page, after you have processed the data, try this:

Expand|Select|Wrap|Line Numbers
  1. <?php 
  2. session_start();
  3.    if(isset($_REQUEST['bla']))
  4.       {
  5.           process the code here, then...
  6.          echo "<script>
  7.                   document.location.href='thispage.url';
  8.                   </script>";
  9.          exit;
  10.       }
  11. ?>
  12.  
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:
Expand|Select|Wrap|Line Numbers
  1. header("Location: thispage.url");
  2.  
Aug 23 '07 #6

entertainmentliveuk
P: 9
You can also swap the JavaScript with a header, like pbmods said.
Like so:
Expand|Select|Wrap|Line Numbers
  1. header("Location: thispage.url");
  2.  
Oooh I like that one... I have not found that!
I'll try it out on my site.
Aug 23 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.