<?php

if ($_SERVER["REQUEST_METHOD"] == "POST") {
   include('connection.php');
  
    $title = $_POST["title"];
    $discription = $_POST["discription"];
    $date = $_POST["date"];
    $qty = $_POST["qty"];
    $currentDateTime = date('Y-m-d H:i:s');
   
    $sql = "INSERT INTO add_assets (title,discription, date, quantity,datetime) VALUES ('$title','$discription', '$date', '$qty','$currentDateTime')";
 
    if ($conn->query($sql) === TRUE) {
        // echo "Record inserted successfully.";
        header("Location: assets.php?success=Assets Added Successfully!!!");
        exit(); 
    } else {
        echo "Error: " . $sql . "<br>" . $conn->error;
    }

    $conn->close();
}
?>