while ($row = mysqli_fetch_assoc($result)) {
$rows[] = $row;
}
$colNames = array_keys(reset($rows));
echo "<thead>";
echo "<tr>";
foreach ($colNames as $colName) {
echo "<th>$colName</th>";
}
echo "<th>SEND EMAIL</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody >";
echo "<tr>";
foreach ($rows as $row) {
foreach ($colNames as $colName) {
echo "<td>" . $row[$colName] . "</td>";
}
echo "<td><a href='Email.php?StudentID=???' class='btn btn-default left-margin'>Email</a></td>";
echo "</tr>";
}
echo "</tbody>";
I am trying to add a button to each of the rows, So when a user clicks the button the correct ID is sent by POST. The column Name that the id resides is called StudentID