gdfhghjdfghgfhf Posted March 6, 2013 Share Posted March 6, 2013 I have very little experience with cookies so i don't know how to do that I have a t-shirt shop where each t-shirt has an $articleID Each time an user visits a t-shirt page, i would like to add the $articleID to a cookie. Add it to an array or something so i can retrieve it later. Then on the main page, i want to retrieve the list of the last 5 $articleID visited and display a list of the ID How could i do that ? thanks! Link to comment https://forums.phpfreaks.com/topic/275298-last-viewed-pages-in-cookie/ Share on other sites More sharing options...
cyberRobot Posted March 6, 2013 Share Posted March 6, 2013 If you're looking to retrieve the article IDs as the visitor is looking around the website, you could consider using a PHP session: http://www.php.net/manual/en/intro.session.php If you're looking to retrieve those article IDs after the visitor leaves the website and comes back a couple days later, for example, you could consider cookies: http://php.net/manual/en/features.cookies.php Link to comment https://forums.phpfreaks.com/topic/275298-last-viewed-pages-in-cookie/#findComment-1416909 Share on other sites More sharing options...
gdfhghjdfghgfhf Posted March 6, 2013 Author Share Posted March 6, 2013 Yeah i would need cookies since i want to track even if the visitor leave the website. So i have an $articleid on each pages, how could i put it in an array or something each time a page is visited, and then retrieve the list of $articleid ? I have really no experience with cookies, i dont know how to do that Link to comment https://forums.phpfreaks.com/topic/275298-last-viewed-pages-in-cookie/#findComment-1416985 Share on other sites More sharing options...
cyberRobot Posted March 6, 2013 Share Posted March 6, 2013 Did you get a chance to look at the link mentioned earlier? http://php.net/manual/en/features.cookies.php More information about setting cookies can be found here: http://www.php.net/manual/en/function.setcookie.php There are also many articles available online for setting cookies with PHP such as this one: http://davidwalsh.name/php-cookies Or you could try Google: https://www.google.com/search?q=create+a+cookie+with+php Link to comment https://forums.phpfreaks.com/topic/275298-last-viewed-pages-in-cookie/#findComment-1416991 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.