Cache-control, browser's back button and form data

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
User avatar
batfastad
Forum Contributor
Posts: 433
Joined: Tue Mar 30, 2004 4:24 am
Location: London, UK

Cache-control, browser's back button and form data

Post by batfastad »

Hi

I'm working on an intranet project and there's a form that users have to fill in.
Sessions are involved in one of the iframes on the page.

When the user submits the form, the data gets validated by my php script.
But if there's an error, I have a link to the previous page

Code: Select all

javascript:history.back();
But when they hit the link their data is gone from the form and they have to enter it all again.

On that form page though, I have the following PHP code which starts the session...

Code: Select all

// START SESSION
session_start();
// 'CACHE-CONTROL: PRIVATE' FIXES SESSIONS BUG IN IE6
header('Cache-control: private');
Although I might be able to get rid of that since sessions are not actually used in this PHP script - only in one of the iframes.

My main question is, what determines whether the data stays in the input fields when the user presses back to a form?
Is it that Cache-control: private header?

Thanks
User avatar
ambivalent
Forum Contributor
Posts: 173
Joined: Thu Apr 14, 2005 8:58 pm
Location: Toronto, ON

Post by ambivalent »

Do a search of this forum for 'sticky forms', you should find what you need.
Post Reply