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