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

include('dbcon.php');

	$namedce = $_POST['dceID'];
	$name = $_POST['ecolenom'];
	
	
	
	$query2=mysqli_query($conn,"select * from tbl_ecole where ecolenom='$name' and dceID='$namedce'")or die(mysqli_error($conn));
		$count=mysqli_num_rows($query2);

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

			

			mysqli_query($conn,"INSERT INTO tbl_ecole(dceID,ecolenom) VALUES('$namedce','$name')")or die(mysqli_error($conn));

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