I am displaying records from a DB using HTML:Template:
my $rows = $dbh->selectall_arrayref($SQL,{Columns =>{}}) ;
$template->param(ROWS => $rows || []);
Fields that can be modified are displayed as text boxes. In addition, next to each row, an update button is also displayed. So a user could modify the value in a text box and click the Update button for that row. eg:
<!-- TMPL_LOOP NAME=ROWS -->
<tr>
.
.
.
<td>
<input type="text" value = "<!-- TMPL_VAR NAME=Detail -->" size="43" n
+ame="Detail">
</td>
<td>
<input type="submit" value="Update">
</td>
</tr>
<!-- /TMPL_LOOP -->
If 5 rows are displayed, there would be 5 Update buttons-one for each row.
What is happening is that the Update button works only for the first row.
How can I associate each Update button with the corressponding row?
Here's the Perl script called when the Update button is clicked(scaled down version):
$ticket = $query->param('TicketNo');
$detail = $query->param('Detail');
.
.
.
my $temp1 = "UPDATE TSIssuesTable ";
my $temp2 = "SET Detail = ?";
my $temp3 = "WHERE ";
my $temp4 = "TicketNo = $ticket";
$SQL = $temp1.$temp2.$temp3.$temp4;
$sth1 = $dbh->prepare( $SQL );
$sth1->execute($details);
...
Thanks!