modification page deposer avis

This commit is contained in:
raphael.palaffre 2019-05-20 17:09:43 +02:00
parent 24ddc892c5
commit d0cb654525
3 changed files with 70 additions and 7 deletions

View File

@ -1,3 +1,10 @@
/*
Crée par PALAFFRE Raphael
Fonction:Depot d'avis
Page PHP : deposer_avis.php
Page HTML : deposer_avis.html
*/
body {
color:black;
background-color:white;
@ -33,16 +40,18 @@ h1{
.rating {
direction: rtl;
}
.rating a {
color: #aaa;
text-decoration: none;
font-size: 3em;
transition: color .4s;
}
.rating a:hover,
.rating a:focus,
.rating a:hover ~ a,
.rating a:focus ~ a {
color: orange;
cursor: pointer;
}
}

View File

@ -1,3 +1,10 @@
<!--
Crée par PALAFFRE Raphael
Fonction:Depot d'avis
Page PHP : deposer_avis.php
Page CSS : deposer_avis.css
-->
<!DOCTYPE html>
<html lang = "fr">
<head>
@ -18,15 +25,24 @@
<div>
<textarea id="avis_laisse" name="avis_laisse" form="formulaire_avis" rows="10" cols="100" placeholder="Avis"></textarea>
</div>
<h2>NOTE</h2>
<div class="rating"><!--
--><a href="#1" title="Donner 1 étoile"></a><!--
--><a href="#2" title="Donner 2 étoiles"></a><!--
--><a href="#3" title="Donner 3 étoiles"></a><!--
--><a href="#4" title="Donner 4 étoiles"></a><!--
--><a href="#5" title="Donner 5 étoiles"></a>
<div class="rating">
<input type="radio" name="note" id="note5" value="5"/>
<a href="#5" label for ="note5" title="Donner 5 étoile"></a>
<input type="radio" name="note" id="note4" value="4"/>
<a href="#4" label for ="note4" title="Donner 4 étoiles"></a>
<input type="radio" name="note" id="note3" value="3"/>
<a href="#3" label for ="note3" title="Donner 3 étoiles"></a>
<input type="radio" name="note" id="note2" value="2"/>
<a href="#2" label for ="note2" title="Donner 2 étoiles"></a>
<input type="radio" name="note" id="note1" value="1"/>
<a href="#1" label for ="note1" title="Donner 1 étoiles"></a>
</div>
</br>
<div>
<input type="submit" value="Valider" id="submit">
</div>

View File

@ -0,0 +1,38 @@
<!--
Crée par PALAFFRE Raphael
Fonction:Depot d'avis
Page HTML : deposer_avis.html
Page CSS : deposer_avis.css
-->
<?PHP
require_once (connexionBD.php);
require_once (user.php);
if (!isset($_SESSION['mail'])) {
header('Location: ../index.php');
exit();
}
if (isset($_GET['codeTrajet'])) {
$mail = $_SESSION['mail'];
$avis = $_POST['avis_laisse'];
$note = $_POST['note'];
$date = date("Y-m-d H:i:s");
$estLu = 0;
$codeTrajet = $_GET['codeTrajet'];
$requete = "INSERT INTO Avis(mailEmetteur,codeTrajet,commentaire,dateAvis,note,estLu) VALUES ($mail,$codeTrajet,$avis,$date,$note,$estLu);";
$envoi = pg_query($db,$requete);
if ($envoi == FALSE){
echo 'Erreur d\'ecriture dans la BD';
}
}else{
echo 'Erreur codeTrajet';
}
?>