<?php
// Include database connection file
include("connection.php");

// Enable error reporting for debugging
error_reporting(E_ALL);
ini_set('display_errors', 1);

if (isset($_POST['submit'])) {
    // Capture values from HTML form
    $EventID = $_POST['Eventid'];
    $AdminID = $_POST['Adminid'];
    $Description = $_POST['description'];
    $Date = $_POST['date'];

    // Prepare SQL query
    $sql = "INSERT INTO event (Event_ID, Admin_ID, Description, Dates) VALUES ('".$EventID."','".$AdminID."','".$Description."','".$Date. "')";


    // Execute the query
     $column = mysqli_query($conn, $sql) or die ("Error: " .mysqli_error($conn));

   if($column != 0) {
        header('Location: postEvents.html');
        exit();
    }

    mysqli_close($conn); //data security purposes
}
?>
