title: Make Query Data Become Link
body: <p>As mentioned in the title, I would like to know how can I make the queried data become a link to another php file. For example, referring to the pic attached below, I would like to show all the cities of United States by just simply click on it and same goes with United Kingdom. I want to make like when I click on any of the state, the php file link to it will automatically know which state I've selected and generate its corresponding cities.</p>
  
  <p><img src="https://i.stack.imgur.com/QkpVF.png" alt="enter image description here"></p>
  
  <p>The following is my code:</p>
  
  <pre><code>&lt;html&gt;
  
    &lt;head&gt;&lt;title&gt;State&lt;/title&gt;&lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;?php
  
   $dbh = pg_connect("host=localhost dbname=state user=postgres");
  
  if (!$dbh) {
      die("Error in connection: " . pg_last_error());
  }
  
  $sql = "SELECT * FROM state ";
  
  
  
   echo "&lt;table&gt;";
   echo "&lt;table border=\"1\" align=\"center\"&gt;";
   echo "&lt;tr&gt;";
   echo "&lt;th&gt;ID&lt;/th&gt;";
   echo "&lt;th&gt;State&lt;/th&gt;";
   echo "&lt;/tr&gt;";
  
  
  $result = pg_query($dbh, $sql);
  
  if (!$result) {
  
      die("Error in SQL query: " . pg_last_error());
  
  }
  
  while ($column = pg_fetch_array($result)) {
  
  echo "&lt;tr&gt;";
  echo "&lt;td&gt;".$column[0]."&lt;/td&gt;";
  echo "&lt;td&gt;".$column[1]."&lt;/td&gt;";   
  echo "&lt;/tr&gt;";
  
  }
  
  echo "&lt;/table&gt;";
  
  
  pg_free_result($result);
  
  
  pg_close($dbh);
  
  
  ?&gt;
  
    &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>