$typeMessage = ""; //Component Class Manager $annuaireManager = new AnnuaireManager($pdo); //Action Add Processing Begin if ($action == "add") { if (!empty($_POST['nom']) and !empty($_POST['telephone1'])) { $nom = htmlentities($_POST['nom']); $description = htmlentities($_POST['description']); $telephone1 = htmlentities($_POST['telephone1']); $telephone2 = htmlentities($_POST['telephone2']); $createdBy = $_SESSION['userMerlaTrav']->login(); $created = date('Y-m-d h:i:s'); //create object $annuaire = new Annuaire(array('nom' => $nom, 'description' => $description, 'telephone1' => $telephone1, 'telephone2' => $telephone2, 'created' => $created, 'createdBy' => $createdBy)); //add it to db $annuaireManager->add($annuaire); $actionMessage = "Opération Valide : Numéro Ajouté(e) avec succès."; $typeMessage = "success"; } else { $actionMessage = "Erreur Ajout Annuaire : Vous devez remplir le champ 'Nom' et 'Téléphone'."; $typeMessage = "error"; } } else { if ($action == "update") { $idAnnuaire = htmlentities($_POST['idAnnuaire']); if (!empty($_POST['nom'])) { $nom = htmlentities($_POST['nom']); $description = htmlentities($_POST['description']); $telephone1 = htmlentities($_POST['telephone1']); $telephone2 = htmlentities($_POST['telephone2']); $updatedBy = $_SESSION['userMerlaTrav']->login();