I'm doing a project where when I click on employees it opens a page with the listing of employees as you can see in the photo. I need the name of each employee to be clickable, to be able to later open the complete page of the official with all other fields (address, birth date, etc.).
Here'swhatI'vetriedsofar(javascriptcodeandphp/html):
jQuery(document).ready(function($){$(".clickable-row").click(function() {
window.location = $(this).data("href");
});
});
<div class="table-responsive">
<?php
if (mysqli_num_rows($result) >0)
{
echo "<table border='1' class='table table-bordered width='100%' id='dataTable' cellspacing='0'>";
echo "<tr><th>Nome Trabalhador</th><th>Função</th><th>ID Trabalhador</th></tr>";
while ($row = mysqli_fetch_array ($result))
{
echo "<tr class='clickable-row' data-href='http://listar_funcionarios.php?id=" . $row['id_trabalhador'] . "/'>";
echo "<td>" . $row['nomeTrabalhador'] ."</td>";
echo "<td>" . $row['funcao'] ."</td>";
echo "<td>" . $row['id_trabalhador']."</td>";
echo "</tr>";
}
echo "</table>";
}
else
{
echo "No results to display!";
}
mysqli_close($link);
?>
</div>