You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PROJET-WEB_STRI1A/WEB/deposer_avis/deposer_avis.php

76 lines
2.0 KiB
PHP

<?php
session_start();
require_once (../connexionBD.php);
require_once (../ressources/user.php);
//Si on est pas connecté redirection vers la page de connexion
if (!isset($_SESSION['mail'])) {
header('Location: ../index.php');
exit();
}
$mail = $_SESSION['mail'];
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';
}
?>
<!DOCTYPE html>
<html lang = "fr">
<head>
<!--
Crée par PALAFFRE Raphael
Fonction:Depot d'avis
Page PHP : deposer_avis.php
Page CSS : deposer_avis.css
-->
<meta charset = "UTF-8">
<link rel = "stylesheet" href = "deposer_avis.css">
<link rel="icon" href="../ressources/favicon.ico" />
<title>Deposer un avis</title>
</head>
<body>
<div id = "container">
<div id ="entete">
<h1 id = "titre">Deposer un avis</h1>
</div>
<div id = "form">
<form id="formulaire_avis" action="deposer_avis.php" method="post">
<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">
<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>
</form>
</div>
</div>
</body>
</html>