<?php
include 'connect.php';
$deleteid = $_GET['deleteid'];
if (isset($deleteid)){
$delsql = $dbh->prepare("delete from contacts where id = '$deleteid'");
$delsql->execute(); 
    echo "Record Deleted!<br>";
}


$sql = $dbh->prepare("select id,fullname from contacts");
$sql->execute();
while ($row = $sql->fetch()){
    $id = $row['id'];
    echo $row['fullname'].'  <a href="contacts.php?deleteid='.$id.'">Delete</a><br>';
}
?>