title: How to populate HTML textbox with MySQL data
body: <p>I'm trying to make an update form. The update part is already working, but it would be better if I'm going to put a view button so that the users will not input the data all over again just to update it.</p>
  
  <p>I'm working on this code, there's a button in the html form with the following code as its form action. Its job is to populate the textboxes with the appropriate data depending on the telephone number entered.</p>
  
  <pre><code>&lt;?php
      $con = mysql_connect("localhost","root","");
      if (!$con)
      {
          die('Could not connect: ' . mysql_error());
      }
      mysql_select_db("hospital", $con);
  
      $result = mysql_query("SELECT * FROM t2 WHERE TELNUM='{$_POST["telnum"]}'");
  
      while ($row = mysql_fetch_array($result))
      {
  
      &lt;form&gt;
          &lt;input  name="lname" type="text"&lt;?php echo $result["lname"];"&gt;
      &lt;/form&gt;
  ?&gt;
  </code></pre>
  
  <p>What's wrong with my code? I'm still a beginner in PHP.</p>