In a php page I'm getting values and I can save it like follows:
<?php
session_start();
// store session data
$_SESSION['advert']=8;
?>
and retrieve it like follows:
<?php
//retrieve session data
echo "advertID=". $_SESSION['advert'];
?>
and I can retrieve the value as 8 later.
But I need to save three product value IDs in a PHP array in a search session and later I need to retrieve them and connect them with the database(my SQL) to build up a compare table among those three products. How can I save three values in a PHP array and retrieve them later in a PHP session?
And if try to save more IDs:
- 4th ID should be replaced with the first value in the array
- 5th ID should be replaced with the second value in the array
- 6th ID should be replaced with the third value in the array and goes like that..