<?php
		
			include('database.php');
			include('config.php');
			DB_connexion(); 
		
			$nom_bloc = $_POST['nom_bloc'];
       		$famille_projet = $_POST['selection_famille'];
       		$nom_projet = $_POST['selection_projet'];
			$date_dispo_schema = $_POST['date_dispo_schema'];
			$date_debut_layout = $_POST['date_debut_layout'];
       		$duree_jours = $_POST['duree_jours'];
       		$date_fin = $_POST['date_fin'];
       		$owner = $_POST['owner'];
			$recommandations = $_POST['recommandations']; 
			
			//echo $nom_bloc ." " .$famille_projet ." " .$nom_projet ." " .$date_dispo_schema ." " .$date_debut_layout
			//	 ." " .$duree_jours ." " .$date_fin ." " .$owner ." " .$recommandations;

			$heure = date("H:i");
			$date = date("d-m-Y"); 
			$infos = $heure ." " .$date;
					
			$table = $nom_projet	."_data";
					
			$sql = "SELECT * FROM $table WHERE nom_bloc = '$nom_bloc' ";
			$requete = mysql_query($sql);   
			$nb_resultats = mysql_num_rows($requete);
 
			if( $nb_resultats > 0 )
			{
				echo "erreur";		
        	}
        	else 
			{ 
						$sql = "INSERT INTO $table(id, nom_bloc , famille_projet , nom_projet , date_dispo_schema , date_debut_layout 
						, duree_jours , date_fin , owner , recommandations, infos)
						VALUES ('', '$nom_bloc' , '$famille_projet' , '$nom_projet' , '$date_dispo_schema' , '$date_debut_layout' 
						, '$duree_jours' , '$date_fin' , '$owner' , '$recommandations', '$infos')";
						$requete = mysql_query($sql);  
						echo "ok";		
			}


?>