I'm trying to work with cookies for the first time. It seems like it should be simple enough, but alas, I'm having some problems. [code] for($i = 0; $i < count($_POST['pid']); $i++) { $cookie_name = 'cart_item[' . $_POST['pid'][$i] . ']'; setcookie($cookie_name, $_POST['qty'][$i], 0, '/'); } [/code] I'm trying use cookies to store an array. The code seems to work as long as I'm setting all the cookies on the page at one time. For instance... [list] [*]If I set a cookie called cart_item[22] = 2 it works fine. [*]If I set cookies called cart_item[22] =2 and another called cart_item[33] = 3 they are both stored fine. [*]However, if cart_item[22] is already set and the script is run to set cart_item[33]... it appears cart_item[22] is overwritten with cart_item[33]. [/list]