From 60eb8bd64af4103e9c5fbc598ed6b8cd18360cc6 Mon Sep 17 00:00:00 2001 From: TheMrNomis Date: Thu, 7 Apr 2016 09:54:26 +0200 Subject: [PATCH] ajout de $edit --- eventAdded.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/eventAdded.php b/eventAdded.php index 0a4f082..910a77d 100644 --- a/eventAdded.php +++ b/eventAdded.php @@ -4,7 +4,9 @@ session_start(); include_once('databaseOperations.php'); include('datetimeOperations.php'); $db = connect(); -if(isset($_POST['id'])) + +$edit = isset($_POST['id']); +if($edit) $id = intval($_POST['id']); $titre = htmlentities($_POST['title']); $localisation = htmlentities($_POST['address']); @@ -34,10 +36,12 @@ foreach($availableCategories as $cat) $catArray[] = $cat['cat_id']; } -if(!isset($_POST['id'])) +if(!$edit) addEvent($db, $titre, $catArray, $localisation, $date['debut'], $date['fin'], $description, $url, $urlImage, $contact); else - updateEvent($db, $id, $titre, $catArray, $localisation, $date['debut'], $date['fin'], $description, $url, $urlImage, $contact); +{ + updateEvent($db, $id, $titre, $catArray, $localisation, $date['debut'], $date['fin'], $description, $url, $urlImage, $contact); +} header('Location:./'); exit; ?>