Hi,
i was wondering if it is possible for me to set a cookie which will accept a value from a page ie product id number and then when they view another page it adds to the existing cookie the second product id number and so on.
Any ideas
Cheers
Kev
setting cookie information
Moderator: General Moderators
Re: setting cookie information
See php.net/setcookie.
I think this is what you're asking:
Not really a "Theory and Design" question.
I think this is what you're asking:
Code: Select all
$product_ids = empty($_COOKIE['product_ids']) ? '' : explode(';',$_COOKIE['product_ids']);
//some code
$product_ids[] = $new_id;
//some more code
implode(';',$product_ids);
setcookie('product_ids',$product_ids, ... );