} else {
    if ($action == "update") {
        $idProjet = htmlentities($_POST['idProjet']);
        if (!empty($_POST['nom'])) {
            $nom = htmlentities($_POST['nom']);
            $nomArabe = htmlentities($_POST['nomArabe']);
            $titre = htmlentities($_POST['titre']);
            $budget = htmlentities($_POST['budget']);
            $superficie = htmlentities($_POST['superficie']);
            $adresse = htmlentities($_POST['adresse']);
            $adresseArabe = htmlentities($_POST['adresseArabe']);
            $description = htmlentities($_POST['description']);
            $updatedBy = $_SESSION['userMerlaTrav']->login();
            $updated = date('Y-m-d h:i:s');
            $projet = new Projet(array('id' => $idProjet, 'nom' => $nom, 'nomArabe' => $nomArabe, 'titre' => $titre, 'budget' => $budget, 'superficie' => $superficie, 'adresse' => $adresse, 'adresseArabe' => $adresseArabe, 'description' => $description, 'updatedBy' => $updatedBy, 'updated' => $updated));
            $projetManager->update($projet);
            //add History data
            $createdBy = $_SESSION['userMerlaTrav']->login();
            $created = date('Y-m-d h:i:s');
            $history = new History(array('action' => "Modification", 'target' => "Table des projets", 'description' => "Modification du projet : " . $nom, 'created' => $created, 'createdBy' => $createdBy));
            //add it to db
            $historyManager->add($history);
            $actionMessage = "Opération Valide : Projet Modifié avec succès.";
            $typeMessage = "success";
        } else {
            $actionMessage = "Erreur Modification Projet : Vous devez remplir le champ <strong>Nom</strong>.";
            $typeMessage = "error";
        }
    }
}
$_SESSION['projet-action-message'] = $actionMessage;