I have the following code:
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td style='visibility:collapse'>" . $row['refereeID'] . "</td>";
echo "<td>" . $row['lastname'] . "</td>";
echo "<td>" . $row['firstname'] . "</td>";
echo "<td>" . $row['zone'] . "</td>";
echo "<td>" . $row['level'] . "</td>";
echo "<td>" . $row['homephone'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "</tr>";
}
echo "</table>";
What I am looking to do is to make the lastname a link to a new page based of the refereeID field which will be hidden in the table. I may not be doing this properly as I suspect that I may not even need to include the 'refereeID' field in the table.
Any advice/help would be appreciated.
Cheers
You can just emit a link with that value. Perhaps something like this:
echo "<td><a href=\"somePage.php?refereeID=" . urlencode($row['refereeID']) . "\">" . htmlspecialchars($row['lastname']) . "</a></td>";
Since the logic and values are available server-side when the page is being rendered, you don't necessarily need to be concerned with generating the link client-side from values in the table. You can just explicitly create it inline when rendering the HTML.
If the cell with the ID is no longer needed at that point, go ahead and remove it.