PROJET-WEB_STRI1A/WEB/deposer_avis/deposer_avis.php

38 lines
757 B
PHP
Raw Permalink Normal View History

2019-05-20 17:09:43 +02:00
<!--
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';
}
?>