note 8595 added to session_start

From: Date: Wed, 20 Sep 2000 20:19:08 +0000
Subject: note 8595 added to session_start
Groups: php.notes 
Request: Send a blank email to php-notes+get-5240@lists.php.net to get a copy of this message
A funny thing that if it happen to you (just like it happen to me few hours ago) to use a form on page that also ha s sessions in it your browser will cache it permanently. It means that if your form, when it's being validated, tells a visitor "a missing email, please return to the form and make corrections" then if he hits back button of his browser none of the fields will remain intact: in fact what you will see is the "first version" of that page, like when you first got there. To fix it is easy: Always use the non-cache header by PHP. Like this: header ("Cache-Control: no-cache, must-revalidate"); header ("Pragma: no-cache"); // See header() In that case your page will be forsed not to be cached and your browser will give you the real "last page" on back button hit. Maxim Maletsky http://www.php.net/manual/function.session-start.php

« previous php.notes (#5240) next »