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

include('dbcon.php');

	$namedpe = $_POST['dpeID'];
	$name = $_POST['dcenom'];
	
	
	
	$query2=mysqli_query($conn,"select * from tbl_dce where dcenom='$name'")or die(mysqli_error($conn));
		$count=mysqli_num_rows($query2);

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

			

			mysqli_query($conn,"INSERT INTO tbl_dce(dpeID,dcenom) VALUES('$namedpe','$name')")or die(mysqli_error($conn));

			echo "<script type='text/javascript'>alert('Merci !!! un nouveau DCE est  enregistrement avec succes!');</script>";
					  echo "<script>document.location='form_dce.php'</script>";  
		}
?>