<?php include('../../config/setup.php');
session_start();
?>
<?php

if(isset($_POST['category_add']))
{
    $cate_name = $_POST['Add_main_cate_name'];
    $cate_status = $_POST['Add_main_category_status'];
    $sub_menu = $_POST['sub_menu'];
    $sql = "INSERT INTO  main_category(Main_Category_Name,Main_Category_Status,sub_menu) Values('$cate_name','$cate_status','$sub_menu')" ;
    
    if($config->query($sql)){
        $_SESSION['status'] = "Added Successfully";
        $_SESSION['alert'] = "success";
        echo "<script>window.location.href='../category_Master.php?msg=505';</script>";	 
        
    }
    else{
        $_SESSION['status'] = "Added Failed";
        $_SESSION['alert'] = "error";
      echo "<script>window.location.href='../category_Master.php?erro=0';</script>".mysqli_error();	 
    
    
    
    }	



}

// if(isset($_POST['category_add']))
// {
// // 	$subimage=$_FILES['Add_main_cate_shopsetting']['name'];
// // 	$subcatephoto="../../../photos/psbanner/".$subimage;
// // 	move_uploaded_file($_FILES["Add_main_cate_shopsetting"]["tmp_name"],$subcatephoto);
// //     $maincate=date('Y-m-d');
//     $cate_name = $_POST['Add_main_cate_name'];
//     $cate_status = $_POST['Add_main_category_status'];
//     $sub_menu = $_POST['sub_menu'];
//     $sql = "INSERT INTO  main_category(Main_Category_Name,Main_Category_Status,sub_menu) Values('$cate_name','$cate_status','$sub_menu')" ;
    
//     // $addmaincate=mysqli_query($config,"insert into main_category(Main_Category_Name,Main_Category_Status,sub_menu,Main_Category_Add_on,Shop_setting)
//     //                              values('".$_POST['Add_main_cate_name']."','".$_POST['Add_main_category_status']."', '$sub_menu','$maincate','$subimage')");	
//     if($addmaincate==false)
//     {
     
//       echo "<script>window.location.href='../category_Master.php?erro=0';</script>".mysqli_error();	 
//     }
//     else{
    
//     echo "<script>window.location.href='../category_Master.php?msg=505';</script>";	 
    
    
//     }	



// }
?>




