<?php
include('includes/dbconnection.php');

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $event_id = intval($_POST['event_id']);
    $title = trim($_POST['edit_title']);
    $date = trim($_POST['edit_event_date']);

    $stmt = $con->prepare("UPDATE events SET title = ?, event_date = ? WHERE id = ?");
    $stmt->bind_param("ssi", $title, $date, $event_id);

    echo ($stmt->execute()) ? "success" : "error";
    $stmt->close();
}
?>
