1
0
This commit is contained in:
Daniel Tartavel 2022-09-21 21:05:44 +02:00
parent 279b720503
commit de10eb8046
2 changed files with 21 additions and 6 deletions

View File

@ -18,6 +18,14 @@ function queryVotationName($db, $idVotation) :string
return $votationLine["libelle"];
}
function queryVotes($db, $idVotation) :array
{
$query = "SELECT * FROM liste_votes WHERE id='" . $idVotation . "'";
$db->query($query);
$votes = $db->result->fetch_assoc();
return $votes;
}
$idVotation = getpost("id");
if (!empty($idVotation))
{
@ -37,8 +45,15 @@ print('<br><br>
<section id="content">
<div class="container">') . EOL;
print(' <div class="row">
<div class="col-lg-12 text-center">
<h3>Nouveau vote pour la votation');
<div class="col-lg-12 text-center">');
$votes = queryVotes($db, $idVotation);
foreach ($votes as $value)
{
print ($value[0] . " " . $value[1] . EOLH);
}
echo EOLH . EOLH;
print(' <h3>Nouveau vote pour la votation');
if (empty($idVotation))
{
@ -55,7 +70,7 @@ if (empty($idVotation))
{
$query = "INSERT INTO liste_votes ('libelle', 'method', 'id_votation') VALUES ('" . $libelle . "', '" . $method . "', '" . $idVotation . "')";
print($query);
//$db->query($query);
$db->query($query);
}
}
$db->close();

View File

@ -125,7 +125,7 @@ function votesForm($path, $libelle = "", $method = 0)
foreach ($methods as $value)
{
$id = $value["id"];
if ($id == $method)/saisieVotes.php
if ($id == $method)
{
print('<option value ="' . $id . '" selected>' . $value["libelle"] . '</option>' . EOL);
}else