TAS-ALFA/blog-post/rating.php
2018-12-06 00:58:20 +01:00

22 lines
684 B
PHP

<?php
include "../settings/db_connect.php";
$_SESSION['message'] = '';
if ($_SERVER['REQUEST_METHOD'] == "POST"){
$rating = $mysqli->real_escape_string($_POST['rating']);
$_SESSION['rating'] = $rating;
$sql = "INSERT INTO rating (rating)"
. "Values ($rating)";
if($mysqli->query($sql) === true){
$_SESSION['message'] = "Dodanie oceny się powiodło!";
header("location:post.php");
}
else{
$_SESSION['message'] = "Nie udało się dodać ooceny!";
}
}
?>