Autofill Input Text Data PHP MYSQL

Autofill Input Text Value for Updating Content

Here is a method to populate input text fields from a database using PHP / mySQL.

<p>
<label style="display:visible;" for="Name">Name:</label>
<input type="text" name="firstname"  value="<?php
$command= "SELECT name FROM table where id='$session_id'";
$result = mysqli_query($db, $command);
while ($row = mysqli_fetch_assoc($result)) {
$name=$row['name'];
echo $name;
}?>" />
</p>