Something like this would echo textboxes with the database values:
<form action="pagename.php" method="post">
<?
$sql_query = mysql_query("PUT THE SELECT QUERY HERE")or die(mysql_error());
$sql_results = mysql_fetch_assoc( $sql_query )or die(mysql_error());
foreach( $sql_results as $key => $value) {
echo "<input type=\"text\" value=\"$value\" name=\"$key\" /> ";
}
?>
</form>
Then to put it back in the database something like:
<?
$sql_query = "UPDATE table_name SET";
foreach( $_POST as $key => $value) {
//Do some validation on the data in the field here
$sql_query .= " $key = '$value',";
}
//Remove the final , from the query
$sql_query = substr_replace($sql_query, "", -1);
mysql_query("$sql_query WHERE condition_here")or die(mysql_error());
?>
There is no data cleansing or validation in the above script, this leaves your code open to injection, make sure you validate any input before processing it.