Dimitar Stoyanov Dimitar Stoyanov - 1 year ago 62
PHP Question

echo <tr> with a href inside not working

I'm pretty confused about the fact that I have this code:

while($row = mysql_fetch_array($result)) {
echo "<tr href='http://google.com'>";
echo "<td>" . $row['rowname'] . "</td>";
echo "<td>" . $row['rowname2'] . "</td>";
echo "<td>" . $row['rowname3'] . "</td>";
echo "<td>" . $row['rowname4'] . "</td>";
echo "</tr>";

and for some reason my link doesn't work. I've tried putting
tag around the
but with no success. Somebody to have a clue?

Answer Source

Guess you are looking for link to entire row. This can be achieved by having onClick function on the row, instead of using href.

<tr onClick="location.href='target url'">
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download