I'd get it to one DB row identified by the ID; e.g. "select from foo
where id='id'". The id would be in the URL of the page to be
displayed; e.g. foo?id=1234. Then my class that dealt with displaying
that URL would get the id from web.input (check it for safety:
http://xkcd.com/327/) and then run the query. The output of the query
would then populate a dictionary mapping form field to form value;
you could do this in a separate object which encapsulates the
dictionary. I would then pass that dictionary (or an object with said
dictionary encapsulated) to my render method. Render would call an
HTML template which was populated using HTML like this:
<input type=text name="something" value="$something">
That way if the form is empty $something doesn't display but if
$something contains a value it will be the default value of your form.
John