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

if(isset($_POST['sub_category_add']))
{
	$addsugcatephoto=$_FILES['Add_sub_cate_icon']['name'];
	$addsubphoto="../../../photos/Slider/".$addsugcatephoto;
	move_uploaded_file($_FILES["Add_sub_cate_icon"]["tmp_name"],$addsubphoto);
$maincate=date('Y-m-d');
$sql ="UPDATE main_category SET sub_menu = '1' WHERE Main_Category_id = '".$_POST['Add_sub_main_cate_Name']."' ";
$res = $config->query($sql);
$addsubcate=mysqli_query($config,"insert into sub_category(Main_Category_sub,Sub_Category_Name,Sub_Category_Status,Sub_Category_Add_on,Add_sub_cate_icon)
                                 values('".$_POST['Add_sub_main_cate_Name']."','".$_POST['Add_sub_cate_name']."','".$_POST['Add_sub_category_status']."','$maincate','$addsugcatephoto')");	
if($addsubcate==false)
{
 	
 	 echo "<script>window.location.href='../sub_category_Master.php?erro=0';</script>".mysqli_error();	 
}
else{
	
	echo "<script>window.location.href='../sub_category_Master.php?msg=505';</script>";	 

	
}	







}
?>




