<?php
    session_start();

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

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