<?php require_once('../auth/auth.php');
if (isset($_POST['newtax'])) {
    $newtax=       $_POST['newtax'];
    $tax_group=    $_POST['tax_group'];
    $tax_margin=   $_POST['tax_margin'];
    $sp_type=      $_POST['sp_type'];

    

if ($newtax=='0') {
    mysqli_query($conn,"INSERT INTO pro_tax(`coid`, `bid`, `brid`, `sp_type`, `tax_group`, `tax_margin`, `uid`, `date`, `active`) VALUES ('$coid','$bid','$brid','$sp_type','$tax_group','$tax_margin','$uid','$datetime','1')")or die(mysqli_error($conn));
} else if($newtax >0){
mysqli_query($conn,"UPDATE pro_tax SET sp_type='$sp_type', tax_group='$tax_group',tax_margin='$tax_margin' WHERE ptid='$newtax'");
echo "update"; 

}

}       
?>