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