<?php
session_name('super_admin_session');
if (!is_dir(dirname(__DIR__) . '/session_data/super')) { mkdir(dirname(__DIR__) . '/session_data/super', 0700, true); } session_save_path(dirname(__DIR__) . '/session_data/super');
session_set_cookie_params(['path' => '/', 'httponly' => true, 'samesite' => 'Strict']);
session_start();
include('includes/dbconnection.php');

if (isset($_POST['feedback_id'])) {
    $feedback_id = mysqli_real_escape_string($con, $_POST['feedback_id']);

    // Delete feedback entry
    $query = "DELETE FROM feedback WHERE id = '$feedback_id'";
    $result = mysqli_query($con, $query);

    if ($result) {
        // Redirect back to feedback.php with success alert
        echo "<script>
            alert('Feedback deleted successfully.');
            window.location.href = 'feedback1.php';
        </script>";
    } else {
        // Redirect back to feedback.php with error alert
        echo "<script>
            alert('Error deleting feedback.');
            window.location.href = 'feedback1.php';
        </script>";
    }
    exit();
}
?>
