Reputation:
I want to pass php value as parameter in anchor hreh.Here i have the problem while fetching the 'c_id'.c_id is the primary key. Here I attached my html code and php code
<?php
include "config.php";
$sql="select c_name from client order by c_name asc limit 10";
$sql1=mysql_query($sql);
echo "<table border='1' align=center width=500 style='border-collapse: collapse;'>";
echo "<tr height =10><td width=300 align=center><b>Client name</b></td><td colspan=2 align=center><b>Action</b></td></tr>";
while($fet=mysql_fetch_assoc($sql1))
{
$id=$fet['c_id'];
echo "<tr>";
echo "<td align=center width=100>".$fet["c_name"]."</td>";
echo "<td align=center width=100><a href='client_details.php?id=".echo $id."'>Edit</a></td><td><a href=''>Delete</a></td>";
echo "</tr>";
echo "</table><br>";
}
?>
Upvotes: 1
Views: 22735
Reputation: 63
Try this, I hope It works for you
<a href="your app url.php?data=phpvariable">Read more</a>
Upvotes: 0
Reputation: 3434
Just change:
echo "<td align=center width=100><a href='client_details.php?id=".echo $id."'>Edit</a></td><td><a href=''>Delete</a></td>";
To:
echo "<td align=center width=100><a href='client_details.php?id=".$id."'>Edit</a></td><td><a href=''>Delete</a></td>";
Because you already used the echo
. You can't use echo
inside another echo
.
Upvotes: 3