title: PDO: how to populate html table with rows from database table?
body: <p>This is my table info in DB.</p>
  
  <pre><code>id         name        age
  1          Vale        23      
  2          Alex        13
  3          Scott       15
  4          Tino        18
  </code></pre>
  
  <p>I have 2 select box and when i pick "Vale" from first and "Scoot" from second selectbox, i like to generate table like this:</p>
  
  <pre><code> id         name        age
   1          Vale        23      
   3          Scott       15
  </code></pre>
  
  <p>Selectbox. </p>
  
  <pre><code>&lt;select name="name1"&gt;
     &lt;option value="Vale"&gt;Vale&lt;/option&gt;
     &lt;option value="Tino"&gt;Tino&lt;/option&gt;
  &lt;/select&gt;
  
  &lt;select name="name2"&gt;
     &lt;option value="Alex"&gt;Alex&lt;/option&gt;
     &lt;option value="Scoot"&gt;Scoot&lt;/option&gt;
  &lt;/select&gt;
  .
  .
  .
  </code></pre>
  
  <p>My page_to_process.php. What i need more, or where is my errors.</p>
  
  <pre><code>&lt;?php
  require('includes/config.php');\\CONNECTION to Database
  
  $sql = $dbh-&gt;prepare("SELECT * FROM info WHERE name = :name");
  $sql-&gt;setFetchMode(PDO::FETCH_ASSOC);
  $sql-&gt;execute([':name' =&gt; $name1]);
  
  
  if($sql-&gt;rowCount() != 0) {
  
  ?&gt;
  &lt;table border="0"&gt;
     &lt;tr COLSPAN=2 BGCOLOR="#6D8FFF"&gt;
        &lt;td&gt;ID&lt;/td&gt;
        &lt;td&gt;Name&lt;/td&gt;
        &lt;td&gt;Age&lt;/td&gt;
     &lt;/tr&gt;
   &lt;?php     
   while($row=$sql-&gt;fetch()) 
   {
        echo "&lt;tr&gt;".
             "&lt;td&gt;".$row["id"]."&lt;/td&gt;".
             "&lt;td&gt;".$row["name"]."&lt;/td&gt;".
             "&lt;td&gt;".$row["age"]."&lt;/td&gt;".
             "&lt;/tr&gt;";
   }
  
  }
  else
  {
       echo "don't exist records for list on the table";
  }
  
  ?&gt;
  &lt;/table&gt;
  </code></pre>