abhi kafle abhi kafle - 5 months ago 33
PHP Question

a href tag inside td tag in php

The every part of code works fine except that i want to go to next page with query to delete the entry. The echoing of td works fine for text , which I want to work as a link.


$result=mysql_query("SELECT fname,lname,post,status FROM staffs");
echo "<table border=1>";
echo "<tr><td>First Name</td><td>Last Name</td><td>Post</td><td>Status</td><td>Edit /Delete</td></tr>";
while ($row=mysql_fetch_array($result))

echo "<tr>";
echo "<td>" . $row['fname'] . "</td>";
echo "<td>" . $row['lname'] . "</td>";
echo "<td>" .$row['post']. "</td>";
echo "<td>". $row['status']. "</td>";
echo "<td> delete </td>"; //In this line, I want to hyperlink it to some other page
echo "</tr>";
echo "</table>";


Yes you can use HTML markup in your PHP

"<td> delete </td>";

"<td><a href='http://yourlink'>delete</a></td>";