<meta charset="utf-8">
<?php 

include('dbcon.php');

	$namedep = $_POST['nomdepartement'];
	$name = $_POST['section'];
	
	
	
	$query2=mysqli_query($conn,"select * from tbl_departement where nomdepartement='fffffff'")or die(mysqli_error($conn));
		$count=mysqli_num_rows($query2);

		if ($count>0)
		{
			echo "<script type='text/javascript'>alert('Désolé!!! Vous enregistrez le departement déjà enregistré');</script>";
			echo "<script>document.location='form_departement.php'</script>";  
		}
		
		else
		{	

			

			mysqli_query($conn,"INSERT INTO tbl_departement(nomdepartement,section,notedep) VALUES('$namedep','$name','NULL')")or die(mysqli_error($conn));

			echo "<script type='text/javascript'>alert('Merci !!! une nouvelle departement est  enregistré avec succes!');</script>";
					  echo "<script>document.location='form_departement.php'</script>";  
		}
?>