<?php
session_start();
include_once 'functions/fungsi.php';
include_once 'connection/koneksi.php';



if (!empty($_FILES['uploaded_file'])) {
    $path = "foto/";
    $path = $path . basename($_FILES['uploaded_file']['name']);
    if (move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $path)) {
        echo "The file " . basename($_FILES['uploaded_file']['name']) .
        " has been uploaded";
    } else {
        echo "There was an error uploading the file, please try again!";
    }
}

$nama = $_POST['nama'];
$harga = $_POST['harga'];
$deskripsi = $_POST['deskripsi'];
$id_karyawan = $_POST['id'];
$gambar = basename($_FILES['uploaded_file']['name']);
$query = 'INSERT INTO menu( `id_karyawan`, `nama`, `harga`,`deskripsi`,`gambar`) VALUES(?, ?, ?, ?, ?)';

$statement = $database->prepare($query);
$statement->bind_param('issss', $id_karyawan, $nama, $harga, $deskripsi, $gambar);
$statement->execute();



redirect('index.php');
?>