title: Display image from dynamic drop down list box
body: <p>I am trying to display image on web page where image path is stored in MySQL table (table column name-location). but I can't able to display the image.</p>
  
  <p>I have a dynamic drop down list box where it populated all the image name. I want to display the image once the user click on the image name from this drop down list. If I place the full path to the img src, then I can able to see my image from the HTML table. Below is my code so far i tried to get output.</p>
  
  <p>Your advice will help me to complete my task. Need your help to update my knowledge.</p>
  
  <pre><code>$(function () {
          $("#Code").change(function () {
              $("#image").load("image.php?choice=" + $("#Code").val());
          });
      });
  </code></pre>
  
  <p>index.php</p>
  
  <pre><code>&lt;?php
  
  mysql_connect('890.23.89.100', 'root', '');
  mysql_select_db('abc');
  
  $sql = "SELECT Code,location FROM Product_List ORDER BY Code ASC";
  $result = mysql_query($sql);
  
  echo "&lt;select id='Code' name='Code' style='width: 120px'&gt;";
  while ($row = mysql_fetch_array($result))
  {
      echo "&lt;option value='" . $row['Code'] . "'&gt;" . $row['Code'] . "&lt;/option&gt;";
  
  }
  echo "&lt;/select&gt;";
  
  ?&gt;
  
  &lt;img
      src="../label_image/6015.jpg (??? how to get the image path here. i put thos manually and can display the image on webpage)"
      width="100%" height="100%"&gt;
  </code></pre>
  
  <p>image.php</p>
  
  <pre><code>&lt;?php
  
  $username = "root";
  $password = "";
  $hostname = "890.23.89.100";
  
  $dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL");
  $selected = mysql_select_db("abc", $dbhandle) or die("Could not select examples");
  $choice = mysql_real_escape_string($_GET['choice']);
  
  $query = "SELECT location FROM Product_List WHERE Code='$choice'";
  
  $result = mysql_query($query);
  
  while ($row = mysql_fetch_array($result))
  {
      echo "&lt;option&gt;" . $row{'location'} . "&lt;/option&gt;";
  }
  ?&gt;
  </code></pre>