I am trying to use sessions for a shopping cart system.
On the additem page i am using:
session_start();
IF($ProdCount==""){
$ProdCount = "1";
}else{
$ProdCount = $ProdCount+1;
session_register("ProdCount");
}
$Prod[$ProdCount] = $Code;
session_register('Prod[ProdCount]');
where $Code is the unique ref for product.
On the view page i am using:
session_start();
for ($i=0; $i<$ProdCount; $i++){
echo 'Prod';
echo $i;
echo ': ';
echo $Prod[$i];
echo '<Br>';
}
This doesnt work!
It does not store the whole code, but only the first char.
Any ideas why?