<?php
include 'db.php';
include 'auth.php';
require_right('Add Supplier');

$name = $_POST['name'];
$contact = $_POST['contact_number'];
$email = $_POST['email'];
$address = $_POST['address'];

$stmt = $conn->prepare("INSERT INTO vendors (name, contact_number, email, address, created_at) VALUES (?, ?, ?, ?, NOW())");
$stmt->bind_param("ssss", $name, $contact, $email, $address);
$stmt->execute();

header("Location: supplier-list.php?success=1");
exit;
?>
