title: how can i Select data from database using input type box and print on same page
body: <p>THIS IS MY CODE HERE I AM GETTING PROBLEM THIS IS A INPUT TYPE TAG AND NOT SELECTED DATA FROM DATABASE USING PHP.
  here is first part of this code is html formatted ad second part is php 
  i want select data from database to data slect to same page as we see on the sopping cart sites</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"         
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;phpSelect&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  Insert Age for search
  &lt;form action="#" method="post" &gt;
  &lt;input type="text" id="val" name="resValue" /&gt;
  &lt;input type="submit" value="submit"  /&gt;&lt;/form&gt;
  &lt;?php
  if(isset($_POST['submit']))
  {
      $res=$_POST['resValue'];
  
      echo $res;
      }
  //echo $res;
  $con=mysqli_connect("localhost","root","","my_db");
  // Check connection
  if (mysqli_connect_errno())
    {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }
  $result = mysqli_query($con,"SELECT * FROM Persons where Age=25");
  echo "&lt;table border='1'&gt;
  &lt;tr&gt;
  &lt;th&gt;Firstname&lt;/th&gt;
  &lt;th&gt;Lastname&lt;/th&gt;
  &lt;/tr&gt;";
  while($row = mysqli_fetch_array($result))
    {
    echo "&lt;tr&gt;";
    echo "&lt;td&gt;" . $row['FirstName'] . "&lt;/td&gt;";
    echo "&lt;td&gt;" . $row['LastName'] . "&lt;/td&gt;";
    echo "&lt;/tr&gt;";
    }
  echo "&lt;/table&gt;";
  mysqli_close($con);
  ?&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>