注意:未定义索引:ID - 根据ID删除记录

I've read the other threads and still unable to figure this out. I'm trying to delete a record within the DB based on it's ID. This code is where the item to be delete is coming from.

echo '<tr>';
        echo '<td>' . $row['site_name'] . '</td>';
        echo '<td>' . $row['site_code'] . '</td>';
        echo '<td>' . $row['site_address'] . '</td>';
        echo '<td>' . $row['site_city'] . '</td>';
        echo '<td>' . $row['site_postalcode'] . '</td>';
        echo '<td>' . $row['id_province'] . '</td>';
        echo '<td>' . $row['id_country'] . '</td>';
        echo '<td><a href="/delete.php?id=' . $row['id'] . '">delete</a></td>';
        echo '<td><a href="/modify.php?id=' . $row['id'] . '">modify</a></td>';
echo '</tr>';

My delete.php contains the following:

<?php
    $con = mysqli_connect("localhost", "root", "", "project1");

    // Check connection
    if (mysqli_connect_errno()) {
       echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }

    $sites_id=$_GET['ID']; 
    if (isset($sites_id)) { 
       $query = mysqli_query("DELETE FROM sites WHERE ID='$sites_id'");  
    }
?>

I get the Notice: Undefined index: ID in C:\wamp\www\delete.php on line 8

PHP is case sensitive for array keys:

    echo '<td><a href="/modify.php?id=' . $row['id'] . '">modify</a></td>';
                                   ^^---lower case
$sites_id=$_GET['ID']; 
                 ^^---upper case

As far as PHP is concerned, ID and id are two completely different array keys.

You have $_GET['ID'] when you should have $_GET['id']. These keys are case sensitive.

In html your id is in lowercase and in php in uppercase...

also change the line

$sites_id = $_GET['ID']; 

if (isset($sites_id))

to

if (isset($_GET['id']))

$sites_id = $_GET['id'];