<?php
session_start();
include "lib/dbcon.php";

$category = mysqli_real_escape_string($con,$_POST['category']);
$sub_category = mysqli_real_escape_string($con,$_POST['sub_category']);
$heading = mysqli_real_escape_string($con,$_POST['heading']);
$content = $_POST['content'];
$filename=$_FILES['image']['name'];
$tempname=$_FILES['image']['tmp_name'];
$file="upload/" .$filename;
// print_r($file);
move_uploaded_file($tempname,$file);

$sub_data = "insert into management(category,sub_category,heading,image,content) values ('$category','$sub_category','$heading','$file','$content')";
 if (mysqli_query($con,$sub_data)) {
	$_SESSION['msg_scs'] = 'Data Inserted...';
	header("location: management.php");
} 
else {
	$_SESSION['msg_err'] = 'Something Went Wrong Try Later..';
	header("location: management.php");
}

?>