Witam od paru godzin próbuje znaleść błąd w kodzie. Gdy klikam przycisk nic się nie dzieje nie wyskakuję napis wypełnij pola, do bazy danych nic nie wchodzi. Dołączam plik z kodem o nazwie post.php.
<?php
session_start();
include_once("db.php");
if(isset($_POST['post'])){
$title = strip_tags($_POST['title']);
$content = strip_tags($_POST['content']);
$title = mysqli_real_escape_string($db, $title);
$content = mysqli_real_escape_string($db, $content);
$date = date('l jS \of F Y h:i:s A');
$sql = "INSERT INTO posts (title, content, date) VALUES ('$title', '$content', '$date')";
if($title == "" || $content == "") {
echo '<p class="errors">please complete your post</p>';
return;
}
mysqli_query($db, $sql);
header("Location: index.php");
}
?>
<!DOCTYPE HTML>
<html>
<head>
<title>blog</title>
<meta charset="utf-8">
<style>
.error{
color: red;
text-decoration: underline;
font-size: 30px;
}
</style>
</head>
<body>
<form action="post.php" method="post" enctype="multipart/form-data">
<input type="text" name="title"><br><br>
<textarea name="content"></textarea><br><br>
<input type="button" name="post" value="post">
</form>
</body>
</html>