1
0

ajout cloture database\najout votes dans database

This commit is contained in:
Daniel Tartavel 2022-09-19 11:06:53 +02:00
parent 2d64ddfbcd
commit 31ede4dc57
3 changed files with 21 additions and 7 deletions

View File

@ -27,6 +27,7 @@ if ($titre !== null and $libelle!== null and $dateDebut!== null and $dateFin !==
$db = new db(); $db = new db();
$query = "INSERT INTO liste_votations ('titre', 'libelle', 'status', 'dateDebut', 'dateFin') VALUES('" . $titre . "', '" . $libelle . "', '0', '" . $dateDebut . "', '" . $dateFin . "')"; // clotûre $query = "INSERT INTO liste_votations ('titre', 'libelle', 'status', 'dateDebut', 'dateFin') VALUES('" . $titre . "', '" . $libelle . "', '0', '" . $dateDebut . "', '" . $dateFin . "')"; // clotûre
$db->query($query); $db->query($query);
$db->close;
}else }else
{ {
votationForm($path, $titre, $libelle, $dateDebut, $dateFin); votationForm($path, $titre, $libelle, $dateDebut, $dateFin);

View File

@ -5,16 +5,17 @@ require_once 'db.class.php';
require_once 'entete.php'; require_once 'entete.php';
require_once 'fonctions.inc.php'; require_once 'fonctions.inc.php';
$idVotation = getpost("id");
$path = $_SERVER["PHP_SELF"];
print('<br><br> print('<br><br>
<!-- lalis Grid Section --> <!-- lalis Grid Section -->
<section id="content"> <section id="content">
<div class="container">') . EOL; <div class="container">') . EOL;
print(' <div class="row"> print(' <div class="row">
<div class="col-lg-12 text-center"> <div class="col-lg-12 text-center">
<h3>Nouveau vote</h3> <h3>Nouveau vote</h3>');
<h4>');
$path = $_SERVER["PHP_SELF"];
$idVotation = getpost("id");
if (empty($idVotation)) if (empty($idVotation))
{ {
if (array_key_exists("idVotation", $GLOBALS)) if (array_key_exists("idVotation", $GLOBALS))
@ -25,8 +26,20 @@ if (empty($idVotation))
choixVotation($path); choixVotation($path);
} }
} }
print("</h4>");
$method = getpost("method");
$libelle = getpost("libelle");
if (empty($method) or empty($libelle))
{
votesForm($path); 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(' </div> print(' </div>
</div> </div>

View File

@ -115,7 +115,7 @@ function votesForm($path, $libelle = "", $method = 0)
<select id="method" name="method" value="'. $method . '">') . EOL; <select id="method" name="method" value="'. $method . '">') . EOL;
if ($method == 0) if ($method == 0)
{ {
print('<option value ="">' . _("Choisissez une option") . '<option>') . EOL; print('<option value ="">' . _("Choisissez une option") . '</option>') . EOL;
} }
foreach ($methods as $value) foreach ($methods as $value)