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

include('dbcon.php');

	$name = $_POST['dpenom'];
	
	
	
	$query2=mysqli_query($conn,"select * from tbl_dpe where dpenom='$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 DPE déjà enregistré');</script>";
			echo "<script>document.location='form_dpe.php'</script>";  
		}
		
		else
		{	

			

			mysqli_query($conn,"INSERT INTO tbl_dpe(dpenom) VALUES('$name')")or die(mysqli_error($conn));

			echo "<script type='text/javascript'>alert('Merci !!! un nouveau DPE est  enregistrement avec succes!');</script>";
					 

					 echo "<script>document.location='form_dpe.php'</script>";  
		}
?>