OK here’s the code
[code=php]
switch (true){
case ($_POST[‘cardType’]==’recognize’):
//$card_id=$_POST[‘card_id’];
$_SESSION[‘card1’]=$_POST[‘card_id’];
echo $_SESSION[‘card1’];
$table=display_cards(‘realize’);
break;
case ($_POST[‘cardType’]==’realize’):
//$card_id=$_POST[‘card_id’];
$_SESSION[‘card2’]=$_POST[‘card_id’];
echo $_SESSION[‘card2’];
$table=display_cards(‘reconnect’);
break;
case ($_POST[‘cardType’]==’reconnect’):
//$card_id=$_POST[‘card_id’];
$_SESSION[‘card3’]=$_POST[‘card_id’];
echo $_SESSION[‘card3’];
$table=display_cards(‘receive’);
break;
case ($_POST[‘cardType’]==’receive’):
$_SESSION[‘card4’]=$_POST[‘card_id’];
echo $_SESSION[‘card2’];
echo $_SESSION[‘card4’];
break;
default:
session_start();
$_SESSION[‘card1’]=”;
$_SESSION[‘card2’]=”;
$_SESSION[‘card3’]=”;
$_SESSION[‘card4’]=”;
$table=display_cards(‘recognize’);
break;
}
It seems that this code resets the session variables every time I run it, so I end up only with the last one that was set.
I just can’t understand why, as the default shouldn’t run if one of the others is true