<?php
include('connection.php');

if (isset($_GET['id'])) {
    $trackId = $_GET['id'];
    
    // Perform the DELETE operation in your database
    $sql = "DELETE FROM track WHERE id = $trackId";
    $result = mysqli_query($conn, $sql);

    if ($result) {
        // Redirect back to the page where contacts are displayed with a success message
        header("Location: add_track.php?msg=3");
        exit();
    } else {
        // Redirect back to the page with an error message if the deletion fails
        header("Location:add_track.php?msg=2");
        exit();
    }
} else {
    // Handle the case where 'id' is not set in the URL
    header("Location:add_track.php?msg=2");
    exit();
}
?>
