11
hulk8
Re: How destroy a variable in a session ?
  • 2006/10/16 17:11

  • hulk8

  • Just popping in

  • Posts: 11

  • Since: 2005/3/16


I've found this afternoon a solution. It's a question of "structure". For my explication, i have simplified the code.

Before, i made that:
for ($i=0$i<$nbvar,$i++) {
   
$_SESSION["var['contact'][$i]"]=$value1[$i];
   
$_SESSION["var['adresse'][$i]"]=$value2[$i];
}

//and for desrtroy

unset($_SESSION["var['contact']"]);
unset(
$_SESSION["var['adresse']"]);

// but that doesn't work

But now i do that:

for ($i=0$i<$nbvar,$i++) {
   
$var["$i"]['contact']=$value1[$i];
   
$var["$i"]['adresse']=$value2[$i];
}

$_SESSION['var']=$var;

//and for desrtroy

unset($_SESSION["var"]);

// and that work :-D