0) { mysql_free_result($rsQuery); $exist=1; } $_SESSION["Nomlocal"]= stripslashes($_POST["Nom"]); $_SESSION["DescriptionLocal"]= stripslashes($_POST["Description"]); $_SESSION["TypeUtilisation"]= stripslashes($_POST["TypeUtilisation"]); $_SESSION["StatutLocal"]= stripslashes($_POST["Statut"]); $_SESSION["Capacite"]= stripslashes($_POST["Capacite"]); $_SESSION["CoutLocal"]= stripslashes($_POST["Cout"]); $_SESSION["CoutMLocal"]= stripslashes($_POST["CoutM"]); //'**********recuperer les valeurs****** $SQLcha = $SQLcha." Nom , "; $SQLval = $SQLval."'".stripslashes($_POST["Nom"])."' , "; $SQLcha = $SQLcha." Description , "; $SQLval = $SQLval."'".stripslashes($_POST["Description"])."' , "; $SQLcha = $SQLcha." TypeUtilisation , "; $SQLval = $SQLval."'".stripslashes($_POST["TypeUtilisation"]). "' , "; $SQLcha = $SQLcha." Capacite , "; $SQLval = $SQLval."'".stripslashes($_POST["Capacite"])."' , "; $SQLcha = $SQLcha." Statut , "; $SQLval = $SQLval."'".$_POST["Statut"]."' , "; $SQLcha = $SQLcha." Cout , "; $SQLval = $SQLval."'".stripslashes($_POST["Cout"])."' , "; $SQLcha = $SQLcha." CoutM , "; $SQLval = $SQLval."'".stripslashes($_POST["CoutM"])."' , "; $SQLcha = $SQLcha." DateAjouter , "; $SQLval = $SQLval."'".date('y-m-j h:i:s')."' , "; /******************Insertion de l'image*******************************/ if (!empty($_FILES['doc_file']['name'])) { $target_path = $target_path.( $_FILES["doc_file"]['name']); if (ereg("\.([^.]+)$", $_FILES['doc_file']['name'], $match)) { $ext = strtolower($match[1]); } //$_FILES["doc_file"]['tmp_name']; // This is how we will get the temporary file... if ($ext!='jpg' and $ext!='png'and $ext!='gif') { $exist=3; }else { if(!move_uploaded_file($_FILES["doc_file"]['tmp_name'], $target_path)) $exist=4; else { $SQLcha = $SQLcha." picture , "; $SQLval = $SQLval."'".($_FILES["doc_file"]['name'])."' , "; } } } /**************************************************************************/ if ((isset($_POST["Nom"]))&&(empty($_POST["Nom"]))) $exist=2; if ($exist!=0) Header("Location: AjouterLocal.php?exist=".$exist.""); //'*********verification si le nom existe ou pas $strSql = "SELECT CodeL from locaux where Nom = '".stripslashes($_POST["Nom"])."' "; $rsQuery = mysql_query($strSql); if ($row = mysql_fetch_assoc($rsQuery)) { $codeL = $row["CodeL"]; mysql_free_result($rsQuery); Header("Location: UpdateLocal.php?codeL=".$codeL.""); } //'*********SQL Insert*************** if ($exist==0) { $Sql="Insert into locaux (". substr($SQLcha, 0, strlen($SQLcha) - 2).") VALUES (". substr($SQLval, 0,strlen($SQLval) - 2).")"; mysql_query($Sql) or die('Error, insert query failed');; } //'********************************** //'*********recuperer le code de personne ******** $strSql = "SELECT CodeL from locaux where Nom = '".stripslashes($_POST["Nom"])."'"; $rsQuery = mysql_query($strSql); if ($row = mysql_fetch_assoc($rsQuery)) { $codeL = $row["CodeL"]; } mysql_free_result($rsQuery); Header("Location:RechercheLocal.php?codeL=".$codeL.""); ?>