<?php
include_once('../../../db_connect/db.php');
	$school_id=mysqli_real_escape_string($con,$_POST["school_id"]);
	$department_id=mysqli_real_escape_string($con,$_POST["department_id"]);
	$title=mysqli_real_escape_string($con,$_POST["title"]);
	$code=mysqli_real_escape_string($con,$_POST["code"]);
	$unit=mysqli_real_escape_string($con,$_POST["unit"]);
	$course_type=mysqli_real_escape_string($con,$_POST["course_type"]);
	$level=mysqli_real_escape_string($con,$_POST["level"]);
	$course_description=mysqli_real_escape_string($con,$_POST["course_description"]);	
	$semester=mysqli_real_escape_string($con,$_POST["semester"]);
	
	$insert="INSERT INTO courses(school_id,department_id,title,code,unit,course_type,level,course_description,semester)
					VALUES('$school_id','$department_id','$title','$code','$unit','$course_type','$level','$course_description','$semester')";

	$sql_insert=mysqli_query($con,$insert) or die(mysqli_error());
	if($sql_insert){

		echo 1;

	}else{
		echo $error='<div class="alert alert-success alert-dismissible" role="alert">
			 <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
			 <strong>Aert!</strong> Course not saved sucessfully.
			</div>';
	}

?>