Hi,
I have built a shopping cart using php. I am currently using session variables to store session_id() in order to identify the products in a users cart.
How can I use cookies to do the same thing?
Thanks.
Cookies for shopping cart
Moderator: General Moderators
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
I don't know why you'd want to. But, instead of setting the session variables, set the cookies.
Would become...
Of course you may wish to store things in arrays and serialize them to send to a single cookie.
Code: Select all
$_SESSION['prod_id'] = 11345614;Code: Select all
setcookie('prod_id',11345614,time()+x);
Last edited by s.dot on Thu Sep 28, 2006 6:46 pm, edited 1 time in total.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London