Beispiel #1
0
<?php

/**
 * Created by PhpStorm.
 * User: Florent
 * Date: 18/02/2015
 * Time: 15:11
 */
require_once '../class/Comment.php';
require_once '../manager/CommentManager.php';
require_once '../bdd/pdo.php';
session_start();
/** Vérification */
if (isset($_POST['produit']) && isset($_POST['note']) && isset($_POST['comment']) && $_POST['produit'] != "" && $_POST['note'] != "" && $_POST['comment'] != "") {
    /** Premiere partie formulaire  $monnouveaucomment */
    $monnouveaucomment = new Comment();
    $monnouveaucomment->setArticleid($_POST['produit']);
    $monnouveaucomment->setNote($_POST['note']);
    $monnouveaucomment->setComment($_POST['comment']);
    /** Insertion en base $monManagerUtilisateur */
    $monManagerComment = new CommentManager($bdd);
    $monManagerComment->insertion($monnouveaucomment);
    /** Redirection */
    header('Location:../main/comment.php');
} else {
    echo "Un des champs est incorrect";
    header('Location:../main/comment.php');
}