|
Posted by leo on 07/23/07 16:05
Hi , i have a problem with session variables.
The web site was already working correctly using sessions, i've had to
add a page which use a new variable session but this new one doesn't
get registered, so when the page redirect to another one the new
variable is vanished.
Here a snippet of the code:
<?php
unset($_SESSION['tipopreventivo']);
//debug
$hand=fopen("public/test.txt","w");
fwrite($hand,print_r($_POST,true));
fclose($hand);
//
if(!empty($_POST))
{
$error=array();
session_register('typep');
$_SESSION['type']=($_POST['type']?$_POST['type']:'Default');
//debug
$hand=fopen("public/session.txt","w");
fwrite($hand,print_r($_SESSION,true));
fclose($hand);
//
if($_POST['info']==1)
{
$url="Location: prev.php";
header($url);
}
}
after submit text.txt e session.txt are right, in particular in
session.txt the variable $_SESSION['type'] is set ad has a value but
after the redirect to prev.php $_SESSION['type'] is not set
The sessions are working becouse other variables are passed correctly.
Any idea of what is wrong?
Navigation:
[Reply to this message]
|