<?php
// Start the session
session_start();
// Include database connection and other necessary files
include 'head.php';
// Check if ID is provided in the URL
if(isset($_GET['id'])){
// Retrieve testimonial ID from the URL
$testimonialId = $_GET['id'];
// Delete testimonial from the database
$deleteSql = "DELETE FROM testimonials WHERE id='$testimonialId'";
if ($conn->query($deleteSql) === TRUE) {
echo "Testimonial deleted successfully.";
// Redirect back to manage-testimonials.php after successful deletion
header("Location: manage-testimonials.php");
exit(); // Ensure no further code execution after redirection
} else {
echo "Error deleting testimonial: " . $conn->error;
}
} else {
echo "Testimonial ID not provided.";
}
?>