I created an HTML table of users using a while loop to get the tables data from the database (dynamic table), but I want to make the rows or at least the first cell of the row clickable, and when clicked it opens another page that displays information about the user from the clicked row kinda like a user profile. the page that displays the information is also dynamic and retrieves data from the database depending on which row was clicked. this my table code
<table class="container">
<thead>
<tr>
<th><h1>Name</h1></th>
<th><h1>Code</h1></th>
<th><h1>Votes Today</h1></th>
<th><h1>Total Votes</h1></th>
</tr>
</thead>
<?php
$conn=mysqli_connect("localhost","root","","voting");
if(!$conn)
die("connection error");
$sql = "SELECT `name`,`code`,`votetoday`,`total` from contestent";
$result = $conn-> query($sql);
if ($result-> num_rows > 0) {
while ($row = $result-> fetch_assoc())
{
echo "<tr><td>" . $row["name"] . "</td><td>" . $row["code"] . "</td><td>" . $row["votetoday"] . "</td><td>".
$row["total"] . "</td><tr>";
}
echo "</table>";
}
?>
</table>
and this is a part of the code for the page that the link should take to. to show the user's information
<?php
$sql1 = mysqli_query($result, "SELECT name, code, Age from contestent,images where
contestent.code = images.cont_id and images.cont_id=3");
// the number three in cont_id=3 shoud be a variable with a value depending on which row was clicked from the table.
while($rows1 = mysqli_fetch_array($sql1))
{
$contName = $rows1 ['name'];
$contAge = $rows1 ['Age'];
$contCode = $rows1 ['code'];
echo "<h3> Name: ". $contName."<br>";
echo "Age: ".$contAge."<br>";
echo "Code: ".$contCode;
}
?>