OK, there may be more to this (and I'm sure others will respond if there
is), but here's my best take on your problem.
You're using the PHP function setcookie() which sets a cookie in the remote
browser, not on the server (check Chapter 19 in the PHP manual for a quick
explanation or read Netscape's cookie spec for ALL of the details). What the
PHP manual doesn't say about the cookie spec is that remote browsers only
allow any given server to set a maximum of 20 cookies on a user's machine.
So, if you're setting any other cookies in your shopping cart application in
addition to the "items" cookie you listed below, you may be hitting that
limit of 20.
If you wish to assign multiple values to a cookie, chapter 19 of the PHP
manual states the following:
"If you wish to assign multiple values to a single cookie, just add  to
the cookie name. "
So if you wanted to set one cookie to hold all of your items, you should be
able to setcookie("items", item1), setcookie("items", item2), etc up to
itemN. Then you can access the items as an array in a PHP script. I'm pretty
sure that handling your list of items in this manner would allow you to
store a large number of items in the same cookie without setting additional
cookies and running into the upper limit of 20. I haven't ever tried it this
way before so I may be totally wrong here. I've never done a shopping cart
application before and usually only set a cookie or two for last visit date,
last page visited, that kind of stuff.
Like I said, this is my best guess as to what your problem may be. Hope it
> -----Original Message-----
> From: Ohlson Stefan [mailto:[EMAIL PROTECTED]
> Sent: Friday, September 05, 2003 8:33 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] setcookie
> (I'm using php3 on an apache-server)
> I'm doing lika a shoppingcart where the user can put items.
> By some reason, when I use setcookie, I can only save between
> 14-17 posts.
> setcookie("items", item1);
> setcookie("items", item2);
> setcookie("items", item17);
> After this it will not save any more items.
> It seems to get full..?
> NE1 had experience with this?
> Or if you have a different and better way to store many
> items on the server for a user they are most welcome!
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php