<?php
// Include the database connection file
require_once 'connection.php';

// Check if form is submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // Escape user inputs for security (assuming connection is established)
    $user_email = $conn->real_escape_string($_POST['user_email']);
    $friend_email = $conn->real_escape_string($_POST['friend_email']);

    // Attempt insert query execution
    $insert_sql = "INSERT INTO `mutefriendstable` (`userEmail`, `friendEmail`) VALUES ('$user_email', '$friend_email')";

    if ($conn->query($insert_sql) === TRUE) {
        echo "Friend muted successfully.";
    } else {
        echo "Error: " . $insert_sql . "<br>" . $conn->error;
    }
}

$conn->close();
?>
