You must Sign In to post a response.
  • Category: HTML

    In php how to delete selected row when user click the delete hyperlink?


    Are you looking for a way to delete selected row when user click the delete hyperlink ? then read this thread to know how to delete it



    Friends,

    I binded some data in table like Id,Name,Address,etc., through php from mysql table. i placed two hyperlinks every row namely edit and delete. if user click the delete hyperlink the selected row want to delete from table. how to delete selected row when user click the delete hyperlink?
  • #748300
    Hi,

    you need to get the id for current selected data in php and delete that record based on the id which you selected when you click the hyperlink.

    echo "<td><a href='" . $row['delete_url'] . "'>delete here</a></td>";

    please check below reference for delete hyperlink the selected row want to delete from table.
    http://stackoverflow.com/questions/9822365/hyperlink-on-every-row-of-mysql-data

    Thanks and Regards
    S.Suresh

    "IF YOU WANT TO SHINE LIKE A SUN FIRST YOU HAVE BURN LIKE IT".

  • #748370
    Hi,

    You can try like this-

    <td><a href="page1.php?id=<?echo $row['id'];?>">Delete</a></td>

    and write the backend logic on page1.php like-

    $id = $_GET['id'];
    mysql_query("DELETE from purchase WHERE id='$id'");

    Thanks,
    Ashutosh Jha
    http://tricksroad.com


  • Sign In to post your comments