0

A user will select a tournament to register for, then add a team, then I store the following into a session:

$teamID;
$tournyID;
$gatefee;
$cost;

When they click add to cart I update the session using this:

$_SESSION[] = $teamID;
$_SESSION[] = $tournyID;
$_SESSION[] = $gatefee;
$_SESSION[] = $cost;

My array comes out like this:

Array
(
[cart] => Array
(
[] => Array
(
[team] => 2137
[tournament] => 24490
[gatefee] =>
[cost] => 575
)

)

)

As you can see there is no KEY so when someone adds another tournament to their cart it overwrites this one. How can I get the KEY to number 0, 1, 2, etc... with each addition to the cart?

Thanks in advance!!!!

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by ShawnCplus
0
$_SESSION['cart'][] = array('team'=> $teamID,'tournament'=>$tournyID,'gatefee'=>$gatefee,'cost' => $cost);

Note the code tags!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.