<?php
// Include the database configuration file
include 'config.php';

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// Retrieve form data
$itemName = $_POST['drinkName'];
$itemPrice = $_POST['drinkPrice'];
$itemImage = basename($_FILES["drinkImage"]["name"]);

// Insert data into database
$sql = "INSERT INTO drink_items (name, price, image) VALUES ('$itemName', '$itemPrice', '$itemImage')";

if ($conn->query($sql) === TRUE) {
    echo "Drink item uploaded and inserted into database successfully!";
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}

$conn->close();
?>
