Jump to content

add to Favorites


jkkenzie

Recommended Posts

Hi!

I would like to add a product id to the browsing session of a web visitor, Just like add to cat. Using a cookie to hold favorites products id  and when they want to view their favorites, I just use the ids to get records using MYSQL query.

 

Any easy shortcuts? Or where to start?

 

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/198471-add-to-favorites/
Share on other sites

try this out

 

<?php

 

// SETTING UP THE COOKIE WITH YOUR VALUES

$val1 = "pronum";

$val2 = "session";

 

 

setcookie("cookie[one]", $val1);

setcookie("cookie[two]", $val2);

 

// GETTING THE COOKIE VALUE WHEN YOU WANT

 

if (isset($_COOKIE['cookie'])) {

 

  $cookieval = $_COOKIE['cookie'];

 

  print $cookieval['one'];

  echo "<br>";

  print $cookieval['two'];

 

}

 

 

?>

Link to comment
https://forums.phpfreaks.com/topic/198471-add-to-favorites/#findComment-1041649
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.