<?php require_once('../auth/auth.php');
if (isset($_POST['newgroup'])) {
    $newgroup=    $_POST['newgroup'];
    $pgroup_name=    $_POST['pgroup_name'];


if ($newgroup=='0') {
    mysqli_query($conn,"INSERT INTO item_group(`coid`,`bid`,`pgroup_name`,`date`,`userid`,`active`) VALUES ('$coid','$bid','$pgroup_name','$datetime','$uid','1')")or die(mysqli_error($conn));
} else if($newgroup >0){
mysqli_query($conn,"UPDATE item_group SET pgroup_name='$pgroup_name' WHERE pgid='$newgroup'");
echo "update"; 

}

}       
?>
<!-- Group Complete -->

<?php 
if (isset($_POST['newcat'])) {
    $newcat=    $_POST['newcat'];
    $pcat_name=    $_POST['pcat_name'];


if ($newcat=='0') {
    mysqli_query($conn,"INSERT INTO item_catagory(`coid`,`bid`,`pcat_name`,`date`,`userid`,`active`) VALUES ('$coid','$bid','$pcat_name','$datetime','$uid','1')")or die(mysqli_error($conn));
} else if($newcat >0){
mysqli_query($conn,"UPDATE item_catagory SET pcat_name='$pcat_name' WHERE pcid='$newcat'");
echo "update"; 

}

}       
?>
<!-- cat complete -->

<?php 
if (isset($_POST['newbrand'])) {
    $newbrand=    $_POST['newbrand'];
    $pbrand_name=    $_POST['pbrand_name'];


if ($newbrand=='0') {
    mysqli_query($conn,"INSERT INTO item_brand(`coid`,`bid`,`pbrand_name`,`date`,`userid`,`active`) VALUES ('$coid','$bid','$pbrand_name','$datetime','$uid','1')")or die(mysqli_error($conn));
} else if($newbrand >0){
mysqli_query($conn,"UPDATE item_brand SET pbrand_name='$pbrand_name' WHERE pbid='$newbrand'");
echo "update"; 

}

}       
?>