<?php 
ini_set('upload_max_filesize', '14M');
include ("connection/conn.php");

if(isset($_POST['save']))
{
    $title = addslashes($_POST['title']);
    $fee = addslashes($_POST['fee']); // Capture fee input

    $Error_msg = "";

    if($title == "") {
        $Error_msg .= "Please enter title.<br>";
    }
    
    if($fee == "" || !is_numeric($fee)) {
        $Error_msg .= "Please enter a valid fee amount.<br>";
    }

    if($Error_msg == "") {	
        $insertRecords = "INSERT INTO course_category SET course='$title', fee='$fee'";
        mysqli_query($link, $insertRecords);
        header("location:manage-Category.php?success=1");
        exit();
    }
}
?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Administrator | Global Waste Solution</title>
		<link href="css/bootstrap.css" rel="stylesheet" />
		<link href="css/style.css" rel="stylesheet" />
		<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
	</head>
	
	<body>
		<div id="wrapper">
			<?php
				include("top-header.php");
				include("right-sec.php");
			?>
			<div id="page-wrapper" >
				<div id="page-inner">
					<div class="row">
						<div class="col-md-12">
							<h3 class="page-header">
								Add Class<small></small>
							</h3>
							<div class="table-sec">
								<div class="srch_box">
									<form name="pnews" id="pnews" method="post" action="" enctype="multipart/form-data">
    <div class="row">
        <div class="col-md-12 col-xs-12">
            <div class="enq_box">
                <div class="col-md-6 col-xs-6">    
                    <div class="form-group form-select">
                        <label>Classes<span>*</span></label>
                        <input class="form-control" type="text" name="title">
                    </div>        
                </div>
                <div class="col-md-6 col-xs-6">    
                    <div class="form-group form-select">
                        <label>Fee<span>*</span></label>
                        <input class="form-control" type="text" name="fee">
                    </div>        
                </div>
            </div>
        </div>    
    </div>
    <div class="row">
        <div class="col-md-4 col-xs-4">    
            <div class="btn_sec">
                <input type="submit" name="save" value="Submit" />
            </div>
        </div>
    </div>
</form>
								</div>
							</div>
						</div>
					</div> 
				</div>
			</div>
			<footer class="footer-sec">
				<div class="container">
					<div class="row">
						<div class="col-md-12">
							<p class="text-center">All right reserved. Template Design by: <a href="">Anshul Chittouria</a></p>
						</div>
					</div>
				</div>
			</footer>
		</div>
		
		
		<!-- jQuery Js -->
		<script src="js/jquery-1.10.2.js"></script>
		<script src="js/bootstrap.min.js"></script>
		<script src="js/jquery.metisMenu.js"></script>
		<script src="js/custom-scripts.js"></script>
	</body>
</html>
