将页面变量保存在本地存储中并将其显示在另一页面中

I have an advertising website I show all my ads in a image gallery and if you click on each of them it goes to a view more page and you can get a lot more data about that ad.

viewmore page
<?php
 error_reporting(0);
include("config.php");
(is_numeric($_GET['ID'])) ? $ID = $_GET['ID'] : $ID = 1;
$result = mysqli_query($connect,"SELECT*FROM ".$db_table." WHERE idhome = $ID");
?>
<?php while($row = mysqli_fetch_array($result)):
$price=$row['price'];
$room=$row['room'];
$parking=$row['parking'];
$floor=$row['floor'];
?>

I've the code in php like this. Now I want to add an option to my view more page and if a user clicks on a button like add this page to favorites the page variables "price", "room", "parking", "floor" save in local storage and display on certain pages which I named the favorite page and every time a user comes to the website he or she can go to the page and review selected pages easely, any idea?

</div>

You can also use LocalStorage:

The localStorage property allows you to access a local Storage object. Data stored in localStorage has no expiration time. In HTML5, is the localStorage object isolated per domain.

An Example:

// Save data to the current local store
localStorage.setItem("username", "John");

// Access some stored data
alert( "username = " + localStorage.getItem("username"));

// Remove some data from Local Storage
localStorage.removeItem('username');

//json example
var car = {};
car.wheels = 4;
car.doors = 2;
car.sound = 'vroom';
car.name = 'Lightning McQueen';
console.log( car );
localStorage.setItem( 'car', JSON.stringify(car) );    //converts the 'car' object into a string and attaches it to the property 'car' of localStorage
console.log( JSON.parse( localStorage.getItem( 'car' ) ) );  //logs an object

Here are some links you can follow to read more about the usage of local storage:

https://developer.mozilla.org/en-US/docs/Web/API/Storage/LocalStorage

https://www.smashingmagazine.com/2010/10/local-storage-and-how-to-use-it/

An Example:

http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_webstorage_local_clickcount

Hope this helps :)