Back and Forward Buttons

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
DudeBori82
Forum Commoner
Posts: 26
Joined: Thu Nov 18, 2004 10:09 am
Location: Florida

Back and Forward Buttons

Post by DudeBori82 »

In the process of using my shopping cart, sometimes when the back and forward buttons are used, it displays "This page cannot be displayed" as if it is a broken link. Sometimes it works, sometimes it doesn't. Why is it doing that? and How can I prevent it from doing that so that the user can navigate freely?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

It displays that, I would think, when post variables were sent to the page. I imagine that if you were to go back to that page, then refresh it, a window would pop up asking if you want to rePOST the form values?. As long as you post forms to a page, you won't be able to navigate freely, which sucks.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post by rehfeld »

this sounds like an IE problem.



at the top of your script, add this

Code: Select all

header('Cache-Control: private');

if that 100% doesnt work all the time, do this

Code: Select all

header('Cache-Control: private, must-revalidate');
and if thats not enough, still do the above, but make your forms like this

Code: Select all

<form method="post" action="script.php?">
notice the ? i put into the action
Post Reply