Hi Monks,
I want to display contents of my oracle table for users to edit it. There are more than 60 fields in the table. I have a saperate table which hold the column names. This is what I am doing-
#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;
The form is displayed but fields do not show data extracted from database! Where am I making mistake? The html tag in form is -
<input type="text" name="fname" size="40" maxlength="60" value="<!-- T
+MPL_VAR fname -->"><!-- TMPL_VAR err_fname -->
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.