<?php
session_start();
require_once("config/configDB.php"); 

function validation_input($data) {
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    return $data;
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {

    $suppliername   = stripslashes($_POST['suppliername']);
    $address1       = stripslashes($_POST['address1']);
    $supplier_state = stripslashes($_POST['state']);
    $pincode        = stripslashes($_POST['pincode']);
    $mobile         = stripslashes($_POST['mobile']);
    $email          = stripslashes($_POST['email']);
    $gstin          = stripslashes($_POST['gstin']);
	 $pan          = stripslashes($_POST['pan']);
    $suppliercode   = stripslashes($_POST['suppliercode']);
	$stype   = stripslashes($_POST['stype']);
    $createdate  	= date("Y-m-d");
    $createdby      = $_SESSION['username'];
    $userID         = $_SESSION['user_id'];
	
	$autoinc=mysqli_query($conn,"ALTER TABLE supplier_master CHANGE id id INT(11) NOT NULL AUTO_INCREMENT ");

    $sql  = "INSERT INTO supplier_master (sname, saddress,  supplier_state, pincode, mobile, email,  gstin,pan,scode,stype, isdelete,createdby,userID,createdate) VALUES ('$suppliername', '$address1',  '$supplier_state',  '$pincode', '$mobile', '$email',  '$gstin', '$pan', '$suppliercode','$stype', '1','".$createdby."','".$userID."','".$createdate."')";

    mysqli_query($conn,$sql);

    $supplierID = mysqli_insert_id($conn);
	
	


$conn->close();
    
    header("Location:supplierMasterDashboard.php");

}





?>