<?php 
session_start();
include('../includes/dbcon.php');

$str=" ";

$cusname= trim($_POST['cusname']);
$address= trim($_POST['address']);
$tel= trim($_POST['tel']);
$email= trim($_POST['email']);
//$web= trim($_POST['web']);
$notes=trim($_POST['notes']);
$city=trim($_POST['city']);
$edate=date("Y-m-d");
$userid=$_SESSION['hrm_id'];



$query=mysqli_query($con," select * from supplier_master where sup_name='$cusname'  ")or die(mysqli_error($con));
    $count=mysqli_num_rows($query);
if ($count>0)
{
	echo "<script type='text/javascript'>alert('Exsisting Supplier!');</script>";
	echo "<script>document.location='admin_supplier.php'</script>"; </div>
}

else {

		if ( mysqli_query($con,"INSERT INTO supplier_master(sup_name,address,telephone,email,sup_active,city,notes,edate,userid) 
			                                 VALUES('$cusname','$address','$tel','$email',1,'$city','$notes',$edate,$userid)  ")or die(mysqli_error($con)))
	        {
					
				//echo "<script type='text/javascript'>alert('Successfully added New Category!');</script>";staff1_id,staff2_id
				echo "<script>document.location='admin_supplier.php'</script>"; 
	     	 
			}
}		

?>