diff --git a/gestionsite/saisieVotes.php b/gestionsite/saisieVotes.php index 3fcd591..22c8fda 100644 --- a/gestionsite/saisieVotes.php +++ b/gestionsite/saisieVotes.php @@ -5,13 +5,27 @@ require_once 'db.class.php'; require_once 'entete.php'; require_once 'fonctions.inc.php'; +$path = $_SERVER["PHP_SELF"]; $db = new db(); -$idVotation = getpost("id"); +function queryVotationName($db, $idVotation) :string +{ + $query = "SELECT libelle FROM liste_votations WHERE id='" . $idVotation . "'"; + $db->query($query); + $votationLine = $db->result->fetch_assoc(); + return $votationLine["libelle"]; +} -$query = "SELECT libelle FROM liste_votations WHERE id='" . $idVotation . "'"; -$db->query($query); -$votationName = $db->result->fetch_assoc(); +$idVotation = getpost("id"); +if (!empty($idVotation)) +{ + $GLOBALS["idVotation"] = $idVotation; + $votationName = queryVotationName($db, $idVotation); +}elseif (array_key_exists("idVotation", $GLOBALS)) +{ + $idVotation = $GLOBALS["idVotation"]; + $votationName = queryVotationName($db, $idVotation); +} print('

@@ -19,22 +33,14 @@ print('

') . EOL; print('
-

Nouveau vote pour la votation : ' . $votationName["libelle"]. '

'); - -$path = $_SERVER["PHP_SELF"]; - -print - -if (array_key_exists("idVotation", $GLOBALS) and empty($idVotation)) -{ - $idVotation = $GLOBALS["idVotation"]; -} +

Nouveau vote pour la votation'); if (empty($idVotation)) { choixVotation($path, 0, false); }else { + print(": " . $votationName . '

' . EOL); $method = getpost("method"); $libelle = getpost("libelle"); if (empty($method) or empty($libelle))