title: Retrieve data from database when a link <a href.. > is clicked using only php and mysql or javascript(if necessary)
body: <p>MY SIMPLE HTML TO PHP TEXT</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
      &lt;a href="description.php" id="1"&gt;&lt;img src="images/ACER/aspire_vx15.jpg" alt="Acer"&gt;&lt;/a&gt;  
      &lt;a href="description.php" id="2"&gt;&lt;img src="images/ACER/G9_593.jpg" alt="Acer"&gt;&lt;/a&gt;
      &lt;a href="description.php" id="3"&gt;&lt;img src="images/ACER/G9_793_75LA.jpg" alt="Acer"&gt;&lt;/a&gt;
      &lt;a href="description.php" id="4"&gt;&lt;img src="images/ACER/G9_793_76CH.jpg" alt="Acer"&gt;&lt;/a&gt;
      &lt;a href="description.php" id="5"&gt;&lt;img src="images/ACER/GX_792.jpg" alt="Acer"&gt;&lt;/a&gt;
      &lt;a href="description.php" id="6"&gt;&lt;img src="images/ASUS/FX753_VD.jpg" alt="ASUS"&gt;&lt;/a&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>MY PHP CODE TO RETRIEVE DATA AGAINST THE ID OF EACH IMAGE IN DATABASE</strong></p>
  
  <pre><code>$host="localhost";
  $dbuser="root";
  $pass="";
  $dbname="mysite";
  $conn = mysqli_connect($host, $dbuser, $pass, $dbname);
  if(mysqli_connect_errno())
  {
      die("Connection Failed! ".mysqli_connect_error());
  }
  else{
      $id="";
      $sql="select * from products where id = $id";
      $query=mysqli_query( $conn,$sql);
  
      while($row = mysqli_fetch_array($query)){
          $id      = $row['id'];
          $brand   = $row['brand'];
          $model   = $row['model'];
          $desc    = $row['description'];
          $img     = $row['image'];
          $price   = $row['price'];
          echo '&lt;h3&gt;&lt;a href="#"&gt;'.$brand.'   '.$model.'&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;' .$img.''.$desc.'&lt;/p&gt;&lt;p&gt;Price: $'.$price.' '
          .'&lt;input type ="button" value="Buy"&gt;&lt;/p&gt;&lt;/br&gt;, ;
      }
  }
  ?&gt;
  </code></pre>
  
  <hr>
  
  <p>In my webpage I created the search field and was able to retrieve data from database by sending keywords by POST method, but I have been trying to give id to href and use that id to POST but its not helping. </p>