title: Display one column from database in PHP
body: <p>Display one or two column only from database in PHP.</p>
  
  <p>I have a MySQL database in PHPMyAdmin. There is a table and in that table, there are multiple columns like salary, salary advance, etc. I want to display when user select salary it only show salary column, that is all data in the salary column. Here is my code. But it doesn't work. Please help.</p>
  
  <pre><code>&lt;?Php
  error_reporting(0);
  include "config_1.php";
  echo "&lt;form  method=post action='viewexpensebagnan.php' &gt;
      &lt;select name='cn'&gt;
         &lt;option value='None'&gt;choose option &lt;/option&gt;
         &lt;option value='salary'&gt; salary &lt;/option&gt;
         &lt;option value='sa'&gt; sa &lt;/option&gt;
         &lt;option value='house'&gt; house &lt;/option&gt;
         &lt;option value='gr'&gt; gr &lt;/option&gt;
         &lt;option value='bo'&gt; bo &lt;/option&gt;
         &lt;option value='goutam'&gt; goutam &lt;/option&gt;
      &lt;/select&gt;
      &lt;input type=submit &gt;&lt;br&gt;
  &lt;/form&gt;";
  if(value=='salary')
  {
      $query="select salary from expensebagnan";
      $count=$dbo-&gt;prepare($query);
      $count-&gt;execute();
      $no=$count-&gt;rowCount();
  
      echo "&lt;table class='border' style='text-align:center;' width='100%'  &gt;";
      echo "&lt;/td&gt;&lt;td&gt;";
      echo "&lt;tr&gt;&lt;th&gt;Salary&lt;/th&gt;&lt;/tr&gt;";
      foreach ($dbo-&gt;query($query) as $row){           
         echo "&lt;tr&gt;&lt;td&gt;$row[salary]&lt;/td&gt;&lt;/tr&gt;";
      }
  
  
      echo "&lt;/table&gt;";
  }
  ?&gt;
  </code></pre>
  
  <p>For example: If I select salary from the dropdown and submit then it will show only salary column data.</p>