PHP Populating array with $variables

Posted by Tom on Stack Overflow See other posts from Stack Overflow or by Tom
Published on 2010-03-23T23:38:49Z Indexed on 2010/03/23 23:43 UTC
Read the original article Hit count: 244

Filed under:
|

Hi, I'm trying to create a basic shopping cart, having an issue with the product page allowing users to add more items to their cart then are in stock (I have code in place to prevent this on the view cart page, just not the view product page)

This is what I have so far;

for ($i = 0; $i < $numItem; $i++) {
extract($cartContent[$i]);
$subTotal += $price * $cartQuantity;
$cartLimiter[$itemNo => $cartQuantity];

Using an array so the position number becomes the item number and the cart quantity becomes the assigned value, however it doesn't seem to like it and throws out on the bottom line of code:

Parse error: syntax error, unexpected T_DOUBLE_ARROW, expecting ']'

Thanks

© Stack Overflow or respective owner

Related posts about php

Related posts about arrays