in reply to Populating a form with data from a DB
Using a templating solution like HTML::Template is a good way to handle this type of thing, because you can usually just pass the hash you get from your database call right into the template's param() method.sub getInvest { my $investID = shift || return {}; # grab row from database with fethrow_hashref() return \%invest; } sub defaultNewInvest { my $q = shift; my $fillIn = getInvest($q->param('investID')); # ... $q->td( ["Title:", $q->textfield(-name=>"invest_title", -size=>40, +-value=>$fillIn->{'invest_title'} )]) ]); }
|
|---|