I am reading some values from an SQLite database, based on a form
my $Fruits= $FORM{Fruits};
my $FruitsTable =0;
Once I get the values from the database, they should be stored in a variable called my $SelectedFruits
.
while ( my @column = $sth->fetchrow_array() ) {
$FruitsTable = 1;
# Within the table there is a row called Tropical which contains bananas, guaves and oranges. I want to select bananas and guaves
my $SelectedFruits = print "<tr>
<td>$Tropical[0]</td>
<td>$Tropical[1]</td>
</tr>";
}
if they are found, a table with my selection should be printed (my problem is when the printing order):
if ( $FruitsTable == 1 ) {
print "<table>
<thead>
<tr>
<th>Bananas</th>
<th>Guave</th>
</tr>
</thead>
<tbody>";
$SelectedFruits;
print "</tbody></table>";
}
The code exits without errors.
The problem here is that $bananas
is printed first and the table's header and footer are printed afterwards, so the table looks crazy.
How can I print the table's header first, then the $bananas
and then the table's footer?