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.
I'm working on this code, it there's a button in the html form that with this code as its form action. It's job is to populate the textboxes with the appropriate data depending on the telephone number entered.
<?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))
{
<form>
<input name="lname" type="text"<?php echo $result["lname"];">
</form>
?>
-Can you tell me what's wrong with my code, I'm still a beginner in php.