<?php
session_start();
require_once "db.php";
$user = $_SESSION['login'];
$dept = isset($_POST['dept']) ? $_POST['dept'] : "";
$title = isset($_POST['title']) ? $_POST['title'] : "";
$starttime = isset($_POST['starttime']) ? $_POST['starttime'] : "";
$endtime = isset($_POST['endtime']) ? $_POST['endtime'] : "";
$start = isset($_POST['start']) ? $_POST['start'] : "";
$end = isset($_POST['end']) ? $_POST['end'] : "";
$hall = isset($_POST['hall']) ? $_POST['hall'] : "";

$sqlInsert = "INSERT INTO tbl_events (title,Department,start,end,starttime,endtime,Staff,Hall) VALUES ('".$title."', '".$dept."', '".$start."','".$end ."','".$starttime."','".$endtime ."' ,'".$user ."','".$hall ."')";

$result = mysqli_query($conn, $sqlInsert);

if (! $result) {
    $result = mysqli_error($conn);
}
?>