Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Navigator refresh button repeats last performed operation 2

Status
Not open for further replies.

paul2000

Technical User
Jan 27, 2002
2
US
Hi,
I am quite new to PHP. I have a small problem with the "Refresh" button.
After an operation is performed (like adding a record) if the user activates the "Refresh" button of the navigator, the operation might be performed a second time ( and even many times ... )

What happens is that Internet Explorer sends a message : "The page cannot be refreshed without resending the information. Click retry to send the information again or click cancel to return to the page that you were trying to view"

-If one clicks "Retry", the last operation ( like adding a record ) is performed a second time ..

-If one clicks "Cancel", one gets the following page :

"Warning: Page has Expired The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you.

To resubmit your information and view this Web page, click the Refresh button. "

And finally, the "Retry" button must be used. The last operation is performed ....

Does anybody ever have the same problem ?
I don't see how to avoid this ....

Thanks for your help.
 
I'd suggest sending the user to another page after you've performed the database operations. Something like
Code:
header ("Location: [URL unfurl="true"]http://www.php.net");[/URL]

DjangMan
 
even a redirect via a header() can make it so that if a user clicks 'back' the same thing will happen.

If you want to eliminate the problem, use javascript's document.replace such as:

<script language=&quot;javascript&quot;>
document.replace(&quot;register_success.php&quot;);
</script>

after you complete the process you are running. This will remove the process page from the browsers history and replace it with your results page. ICQ: 54380631
 
Sorry,

it is location.replace, not document.replace

Chad. ICQ: 54380631
 
Thanks for your answers. I appreciate.
location.replace works perfectly.

Paul.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top