Dimitar Stoyanov Dimitar Stoyanov - 4 months ago 7
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?


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'">