<?php
session_start();
include("db.php");
$name=$_POST['ProductName'];
$des=$_POST['ProductDesc'];
$img=$_POST['ProductImage'];
$price=$_POST['ProductPrice'];
$stock=$_POST['Stock'];
$CompName=$_SESSION['name'];
$id=$_SESSION['id'];
$sql="INSERT INTO `Products`(`User_id`,`ProductName`, `CompanyName`, `ProductDescription`, `ProductImage`, `ProductPrice`, `Stock`) VALUES (?,?,?,?,?,?,?)";

$stmt=mysqli_stmt_init($conn);
mysqli_stmt_prepare($stmt,$sql);
mysqli_stmt_bind_param($stmt,"issssii",$id,$name,$CompName,$des,$img,$price,$stock);
if(mysqli_stmt_execute($stmt)){
    echo"<script>alert(successfully added product);</script>";
    echo"<script>window.location.href='ProducerHome.php';</script>";
}

?>