title: save page id in cookies and retrieve that certain id's row from database in other page
body: <p>hi every one i am designing a real estate website i have many ads in my website and when user click on a certain ad it goes to another page "viewmore.php" which gives user more details about that certain ad.  so far i create a 'favorite' or 'save' button on viewmore page that will save the selected page title in a certain page based on cookies for user to read later.
  Now i want to send ad's id to the favorite page when ever user click on "add to favotites" thus based on id i can fetch that certain ad data from database . like the page title i want to do this based on cookies.
  can i do this? how? this is my current code
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>//viewmore.php
  &lt;?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");
  ?&gt;
  &lt;?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");
  ?&gt;
  &lt;?php $row = mysqli_fetch_array($result):
  $price=$row['price'];
  $rent=$row['rent'];
  $room=$row['room'];
  $date=$row['date'];
  ?&gt;
  &lt;?php 
  $cookie_name = "favoritepost";
  $cookie_value ="$ID";
  setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/"); // 86400 = 1 day
  ?&gt;
  &lt;?php 
  echo"price";
  echo"room";
  echo"date";
  ?&gt;</code></pre>
  </div>
  </div>
  
  and this is my javascript code which i save page title and page url in cookies after user click on add to favorites</p>
  
  <p>any idea thank u</p>