Hello,
I am asking your help on a session pb:
This code work fine. If I refresh the page or come back on it, the value $SESSION[ 'unlost' ][ 'Toto' ] is incremented. Fine.
But if I validate the form (method = post or get), a new session is created and so $SESSION[ 'unlost' ][ 'Toto' ] normaly get the value 1.
PHP 4.3.4
Thanks for your answer.
Best regards
Joseph
<?php
session_cache_limiter('no-cache, must-revalidate'); //'private, must-revalidate'
header('Cache-Control: no-cache, must-revalidate'); //'Cache-Control: private, must-revalidate'
session_start(); // start the session.
//session_start();
if ( ! isset( $SESSION[ 'unlost' ] ))
$SESSION[ 'unlost' ] = array();
$SESSION[ 'unlost' ] = &$SESSION[ 'unlost' ];
if ( ! isset( $SESSION[ 'unlost' ][ 'Toto' ] ))
$SESSION[ 'unlost' ][ 'Toto' ] = 0;
$SESSION[ 'unlost' ][ 'Toto' ] += 1;
echo '$SESSION[ unlost ][ Toto ] = ' . $_SESSION[ 'unlost' ][ 'Toto' ];
?>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" id="form" method="post">
<table border=0><tr>
<td>Votre e-mail:</td>
<td><input type=text name="mail" value="" maxlength="255" size="40"></td>
</tr><tr>
<td></td>
<td><input type=submit value="Se connecter"></td>
</tr></table>
</form>