<?php
session_start();
if(!isset($_SESSION['aid']))
{
	echo '<script>location.href="../index.php"</script>';
}

include "../connection/config.php";

if(isset($_POST['submit']))
{
 
    $flag=$_POST['flag'];
    $cid=$_POST['cid'];
    $category = strtoupper($_POST['category']);

if($flag==0)
{

  $sql="insert into item_category(category)
        values('$category')";
  $exe=mysqli_query($con,$sql);
  echo '<script>location.href="item_category.php"</script>';
}
if($flag==2)
{
    $sqli="update item_category set category='$category' where cid='$cid'";  
    $exee=mysqli_query($con,$sqli);
    echo '<script>location.href="item_category.php"</script>';
}
}
?>