<?php
    session_start();

    require("../includes/database_connect.php");

    $description = $_POST['description'];
    $brand = $_POST['brand'];
    $quantity = $_POST['quantity'];
    $location = $_POST['location'];
    
    $sql = "insert into tools (description,brand,quantity,location) values ('".$description."','".$brand."','".$quantity."', '".$location."')";
    if ($conn->query($sql)) {
        $_SESSION['success'] = $description." insert successfully";
    } else {
        $_SESSION['error'] = "Error updating record: " . $conn->error;
    }
    
    header('location: ../tools_listing.php');
?>