Hello!
I've got the code below which takes data from my db and displays it to the page listing reports submitted by the user. At the end of each row I have button that is supposed to launch a PDF generator so that the user can view their report. I have multiple rows, yet only the bottom row button will work correctly. If I click the submit button on any of the rows prior to the last row, the data for the last report will be displayed. I'd appreciate any help with this. Thanks!
<form name="vin_report_table" action="reportPDF.php" method="post">
<table>
<?php
$color = "#cccccc";
echo "<tr bgcolor=\"" . $color . "\"><td><strong>VIN</strong></td>";
echo "<td><strong>Year </strong></td>";
echo "<td><strong>Model </strong></td>";
echo "<td><strong>Date </strong></td><td></td></tr>";
echo "<br>";
if(mysql_num_rows($result)){
while($row = mysql_fetch_assoc($result)){
if ($color == "#cccccc") {
$color = "#ffffff";
} else {
$color = "#cccccc";
}
echo "<tr bgcolor=\"" . $color . "\"><td>".$row['vin_full']. "</td>
<td>" . $row['vin_model'] . "</a></td>
<td>" . $row['vin_year'] . "</a></td>
<td>". $row['vreport_timestamp'] . "</a></td>
<td><input type=\"hidden\" name=\"u\" value=\"".$username."\"/>
<input type=\"hidden\" name=\"rid\" value=\"".$row['report_id']."\"/>
</><input type=\"submit\" value=\"View Report\" /></td></tr>\n";
}
} else {
echo "<tr><td>No reports on record</td></tr>";
}
?>
</table>
</form>
Thanks!