<?php
include_once('../../../db_connect/db.php');
	$title=mysqli_real_escape_string($con,$_POST["title"]);
	$code=mysqli_real_escape_string($con,$_POST["code"]);
	$school_id=mysqli_real_escape_string($con,$_POST["school_id"]);
	$faculty_id=mysqli_real_escape_string($con,$_POST["faculty_id"]);
	$level=mysqli_real_escape_string($con,$_POST["level"]);
	$required_subjects=mysqli_real_escape_string($con,$_POST["required_subjects"]);
	$optional_subjects=mysqli_real_escape_string($con,$_POST["optional_subjects"]);
	$duration=mysqli_real_escape_string($con,$_POST["duration"]);
	$maximum_credit_load=mysqli_real_escape_string($con,$_POST["maximum_credit_load"]);
	$minimum_credit_load=mysqli_real_escape_string($con,$_POST["minimum_credit_load"]);
	
	$insert="INSERT INTO programmes(title,code,school_id,faculty_id,level,required_subjects,optional_subjects,duration,maximum_credit_load,minimum_credit_load)
					VALUES('$title','$code','$school_id','$faculty_id','$level','$required_subjects','$optional_subjects','$duration','$maximum_credit_load','$minimum_credit_load')";

	$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> Programme not saved sucessfully.
			</div>';
	}

?>