On May 7, 2010, at 10:35 PM, Charlene Wroblewski wrote:
Karl DeSaulniers wrote:
On May 7, 2010, at 2:06 PM, Charlene Wroblewski wrote:
I have a problem with IE7. It has a tendency to cache output
produced by PHP. It occurs in a few ways:
* I make a minor change to a php program, but you can't see it in
IE7, but can in FF. CTRL-Refresh does not make it work.
* I modify data using a form in IE7. When I click on a link to
return to the form the old data is still there, but if I hit
CTRL-Refresh the new values are there.
I have set up some caching to try to fix the second issue, but
I'm not sure if I've chosen the right header lines:
$now = time ();
$prety_lmtime = gmdate ('D, d M Y H:i:s', $now). ' GMT';
$prety_emtime = gmdate ('D, d M Y H:i:s', $now + $interval). '
GMT';
// Backwards Compatibility
header ("Last Modified: $prety_lmtime");
header ("Expires: $prety_emtime");
// HTTP/1.1 Support
header ("Cache-Control: private, max-age=$interval,s-maxage=0");
I got this code from a book. I don't want to prevent caching
completely because I want to be able to go back to the form when
there is an error in validation of fields before entering it into
the db. But I do want to be able to see the new data after it is
entered in the db.
Charlene
Sounds like you need attach the data somehow when hitting that
return link. Maybe an array
$newData = array();//fill this array with the new values
On your form page, set up a
if(isset($newData)){
//fill form fields
}
I did notice that on your header, you did not have "no-cache".
header ("Cache-Control: private, no-cache, max-age=$interval,s-
maxage=0");
Actually, I should have looked at which caching code I was using
for the second problem. This is the code:
header ("Expires: 0");
header ("pragma: no-cache");
// HTTP/1.1 Support
header ("Cache-Control: no-cache,no-store,max-
age=0,s-maxage=0, must-revalidate");
About storing the values, I really would rather the browser keep
track of form input if I can. It could get confusing trying to
store temporary information, especially since the form is being
used to modify a client profile as well as create a new password
for the first time in the application (not my choice - I'd rather
do passwords first and then allow them to modify info).
Charlene
Are you using sessions? I would store it in a session variable. That
shouldn't make things too confusing.
Also, I would make sure the form page header has the no-cache in it,
since that is the page you dont want caching.
Or call on that form page with the time attached to the end of the
link url like what what suggested by Bastien.
This will make sure that page doesn't cache. Then set up your session
variables to store the form results.
Then use the isset condition on the form page to apply the new values
if they are present.
MBG
Karl
Karl DeSaulniers
Design Drumm
http://designdrumm.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php