Hi,

I use PHP and have a question.

As cookies and sessions have their pros and cons, I don’t know which one is better for shopping card.

If I use cookie then user my block it. Therefore, my e-commerce web site won’t serve the purposes.
If I use session then the content stored in current session will not be remembered in next visit.


What do you prefer?

Thanks

Hi,

I use PHP and have a question.

As cookies and sessions have their pros and cons, I don’t know which one is better for shopping card.

If I use cookie then user my block it. Therefore, my e-commerce web site won’t serve the purposes.
If I use session then the content stored in current session will not be remembered in next visit.


What do you prefer?

Thanks

I think you may have to use user details such as login values(username) or ip address(to save visitor selection of items) along with sessions values such as items in the cart and save it database to retrieve for visitors next visit.

Well if they block cookies they're blocking sessions as well since a user's SESSIONID is stored in a cookie.

Well if they block cookies they're blocking sessions as well since a user's SESSIONID is stored in a cookie.

Using Sessions one need not store it on user's computer,
if we store the users ip and items in the cart in the database by sessions and later retreive them from database when visitor visits back and use them wouldnt that work?

Using Sessions one need not store it on user's computer,
if we store the users ip and items in the cart in the database by sessions and later retreive them from database when visitor visits back and use them wouldnt that work?

Nope, different ip same user
same ip different user
ip addresses are not fixed they are at the discretion of the ISP

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.