connect_error) { die("Connection failed: " . $conn->connect_error); } // Function to add a product function addProduct($name, $description, $price) { global $conn; $stmt = $conn->prepare("INSERT INTO products (name, description, price) VALUES (?, ?, ?)"); $stmt->bind_param("ssd", $name, $description, $price); $stmt->execute(); echo "New product added successfully"; $stmt->close(); } // Example usage if(isset($_POST['submit'])) { addProduct($_POST['name'], $_POST['description'], $_POST['price']); } $conn->close(); ?>