Brad Bonkoski wrote:
> Why not just have another array...
>
> $bag = array();
> $item[] ....
>
> array_push($bag, $item);
>
> then store the bag in the session.
> so, you would have count($bag) items in your shopping cart, and you
> would be able to easily access them.
> Just a thought, instead of munging variable names.
>
> -B
>
use the $_SESSION super global instead of using session_register()
(read the manual for the fine print regarding $_SESSION and why
session_register() is no longer recommended)
e.g.:
function addItemToBag($item)
{
if (!isset($_SESSION['bag'])) $_SESSION['bag'] = array();
$_SESSION['bag'][] = $item;
}
>>
>> session_register('item');
>>
>> In the session the item is known as 'item'. What I need for it to be is
>> 'item1' so when the customer chooses another product I can increase
>> $count
>> by 1 and have the next array with values stored as 'item2'.
>>
>> Thanks for any help,
>>
>> Ed
>>
>>
>>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php