diff --git a/gestionsite/saisieVotation.php b/gestionsite/saisieVotation.php index 6e412c7..1ed7ba1 100644 --- a/gestionsite/saisieVotation.php +++ b/gestionsite/saisieVotation.php @@ -27,6 +27,7 @@ if ($titre !== null and $libelle!== null and $dateDebut!== null and $dateFin !== $db = new db(); $query = "INSERT INTO liste_votations ('titre', 'libelle', 'status', 'dateDebut', 'dateFin') VALUES('" . $titre . "', '" . $libelle . "', '0', '" . $dateDebut . "', '" . $dateFin . "')"; // clotûre $db->query($query); + $db->close; }else { votationForm($path, $titre, $libelle, $dateDebut, $dateFin); diff --git a/gestionsite/saisieVotes.php b/gestionsite/saisieVotes.php index 7aeb845..72ff932 100644 --- a/gestionsite/saisieVotes.php +++ b/gestionsite/saisieVotes.php @@ -5,16 +5,17 @@ require_once 'db.class.php'; require_once 'entete.php'; require_once 'fonctions.inc.php'; -$idVotation = getpost("id"); -$path = $_SERVER["PHP_SELF"]; print('

') . EOL; print('
-

Nouveau vote

-

'); +

Nouveau vote

'); + +$path = $_SERVER["PHP_SELF"]; +$idVotation = getpost("id"); + if (empty($idVotation)) { if (array_key_exists("idVotation", $GLOBALS)) @@ -25,8 +26,20 @@ if (empty($idVotation)) choixVotation($path); } } -print(""); -votesForm($path); + +$method = getpost("method"); +$libelle = getpost("libelle"); +if (empty($method) or empty($libelle)) +{ + votesForm($path); +}else +{ + $db = new db(); + $query = "INSERT INTO liste_votes ('libelle', 'method', 'id_votation') VALUES ('" . $libelle . "', '" . $method . "', '" . $idVotation . "')"; + print($query); + //$db->query($query); + $db->close; +} print('
diff --git a/include/fonctions.inc.php b/include/fonctions.inc.php index 6fed846..de7ec8b 100644 --- a/include/fonctions.inc.php +++ b/include/fonctions.inc.php @@ -115,7 +115,7 @@ function votesForm($path, $libelle = "", $method = 0)