//classes loading end session_start(); //post input processing $codeFournisseur = ""; $fournisseur = ""; $fournisseurManager = new FournisseurManager($pdo); //test if fournisseur row exist in the db if yes we load if (!empty($_POST['idFournisseur'])) { $idFournisseur = $_POST['idFournisseur']; $fournisseur = $fournisseurManager->getFournisseurById($idFournisseur); $codeFournisseur = $fournisseur->code(); } else { if (empty($_POST['idFournisseur'])) { if (!empty($_POST['nom'])) { $nom = htmlentities($_POST['nom']); if ($fournisseurManager->exists($nom)) { $_SESSION['fournisseur-add-error'] = "<strong>Erreur Ajout Fournisseur : </strong>Un fournisseur existe déjà avec ce nom : " . $nom . "."; $redirectLink = 'Location:../fournisseurs.php#tab_1'; if (isset($_GET['p']) and $_GET['p'] == 1) { $redirectLink = 'Location:../livraisons.php'; } header($redirectLink); exit; } else { $adresse = htmlentities($_POST['adresse']); $telephone1 = htmlentities($_POST['telephone1']); $telephone2 = htmlentities($_POST['telephone2']); $email = htmlentities($_POST['email']); $fax = htmlentities($_POST['fax']); $created = date("Y-m-d"); $codeFournisseur = uniqid() . date('YmdHis');