session array variable fatfree

875 views Asked by At

i am playing with my own way of storing user selected items on a simple shop system which uses the hidden int values( primary id for item) from a form.
On each selection i test to see if session variable has been set if not:

 if ($f3->get('SESSION.item') == NULL)
         {
        $f3->set('SESSION.item',array($itemFromPost ));
                ...
}

if it has been set then i push next selection :

$f3->push('SESSION.item',$itemFromPost);

it look promising and i can get count of items like:

$total = (count ( $f3->get('SESSION.item')

Also i can do this:

echo $f3->get('SESSION.item[0]');

what doesn't work is when i want to run through items:

for ($i= 0; $i <= TotalCountValueMinus1; $i++ ) 
   {

   echo $f3->get('SESSION.item[$i]');

   }

how do i do this?

0

There are 0 answers