I have a view list that displayed through php
$quedchan=pg_query("SELECT agent.agentname, agent.onlinename, agent.channel, agentgroup.leadername FROM Agent LEFT JOIN agentgroup on agent.agentid=agentgroup.agentid where agent.channel like '%$DCH%'order by agent.channel");
echo "<td class=\"form1\" align=\"center\" > Number </td>";
echo "<td class=\"form1\" align=\"center\" > Agent Name </td>";
echo "<td class=\"form1\" align=\"center\"> Agent Online Name </td>";
echo "<td class=\"form1\" align=\"center\"> Agent Channel </td>";
echo "<td class=\"form1\" align=\"center\"> Agent Group </td>";
echo "<td class=\"form1\" align=\"center\"> </td>";
$counttttt=1;
While($row3=pg_fetch_array($quedchan))
echo "<tr>";
echo "<td class=\"forma\" align=\"center\"> ".$counttttt++." </td>";
echo "<td class=\"forma\"name=\"dement\" align=\"left\"style=\"padding-left:10%;\"> ".$row3['agentname']." </td>";
echo "<td class=\"forma\" align=\"left\"style=\"padding-left:8%;\"> ".$row3['onlinename']." </td>";
echo "<td class=\"forma\" align=\"left\"style=\"padding-left:8%;\"> ".$row3['channel']." </td>";
echo "<td class=\"forma\"align=\"left\"style=\"padding-left:6%;\"> ".$row3['leadername']." </td>";
echo "<td class=\"forma\" align=\"center\"><img src=\"image\\delete.png\" width=\"20px\" height=\"20px\" style=\"padding-left:22%;cursor:pointer;\"/></td>
</tr>";
And I want to make a delete function, so that the delete image of a row can delete its row. I made this by give a name for agentname row, name=\"dement\". in order to catch the value I want to delete. Im using php in another page called delete.php :
<?php
session_start();
include 'connect.php';
$dagname=$_GET['dement'];
$queda="DELETE FROM Agent where agentname='$dagname'";
$result=pg_query($queda);
if($result)
{
$_SESSION['delMessage11']='Selected Agent is successfully deleted!';
header('Location: Dagent.php');
}
else
{
echo "ERROR!";
}
?>
It doesnt work. I tried to use a reference from http://www.phpeasystep.com/mysql/7.html. it says I can get value of id (which I replace with agentname now) that sent from address bar. I implement it and become this
echo "<td class=\"form2\" align=\"center\"><a href=\"delete.php?agentname=<? echo ".$row3['agentname'].";?>\">\"<img src=\"image\\delete.png\" onclick=\"dela();\" width=\"20px\" height=\"20px\" style=\"padding-left:22%;cursor:pointer;\"/></a></td>
</tr>";
But it doesnt work. Any help? Thank you