bar10der has asked for the wisdom of the Perl Monks concerning the following question:
The form is displayed but fields do not show data extracted from database! Where am I making mistake? The html tag in form is -#Select fieldnames from accfields table in @fields. my @fields = getMultiRows($sql,1,$dbh); ##A saperate perl routine to e +xtract data. my $fields = join(",",@fields); $sql = "SELECT $fields FROM tran WHERE account=?"; my $sth = $dbh->prepare($sql); if(!$sth){$err= "Error preparing query " . $sql . " : ". $dbh->errstr; +} if(!$sth->execute(177)){$err = "Error Executing query " . $sql . " : " +. $dbh->errstr;} my %rows = $sth->fetchrow_hashref; # Now i get the html template and want to populate html form fields wi +th data extracted. All form field names are same as table column na +me. foreach(@fields){ $template->param($_=>$rows{$_}); } return $template->output;
<input type="text" name="fname" size="40" maxlength="60" value="<!-- T +MPL_VAR fname -->"><!-- TMPL_VAR err_fname -->
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Unable to display data from hash array
by Happy-the-monk (Canon) on Jun 14, 2004 at 13:56 UTC | |
by bar10der (Beadle) on Jun 14, 2004 at 14:34 UTC | |
|
Re: Unable to display data from hash array
by benrwebb (Scribe) on Jun 14, 2004 at 16:12 UTC |