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

23 lines
716 B
PHP

<?php
include "../settings/db_connect.php";
$_SESSION['message'] = '';
$post=$_GET['post'];
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?post=$post");
}
else{
$_SESSION['message'] = "Nie udało się dodać ooceny!";
}
}
?>