I'm setting up a simple system that takes the user input in a new\_post.php file in a form and sends that information using POST to index.php. index.php then receives that information, and, if it exists, it will post, otherwise, it won't. But it simply doesn't work! It gives some kind of "PHP Notice: Undefined index:" error thing in error\_log.

I've tried checking the SQL, but it was fine, unless I didn't notice something. But here's some code, so you experts can help me:

INDEX.PHP:

```php
if($_POST["title"] != null) {
if($_POST["author"] != null) {
if($_POST["content"] != null) {
$sql = "INSERT INTO posts (title, content, author) VALUES ('" . $_POST["title"] . "', '" . $_POST["content"] . "', '" . $_POST["author"] . "'');";
mysqli_query($connection, $sql);
}
}
}

```

NEW\_POST.PHP:

```html
<form action="index.php" style="font-size: 3vw; margin-left: 25%; margin-right: 25%; width: 50%;" method="POST">
Title:<br>
<input type="text" name="title" value="" style="font-size: 2vw;">
<br>
Your Name:<br>
<input type="text" name="author" value="" style="font-size: 2vw;">
<br>
Content<br>
<textarea type="text" name="content" value="" style="resize: none; font-size: 2vw;"></textarea>
<br>
<br><br>
<input type="submit" value="Submit">
</form>

```

I expected it to, if the user didn't fill the form, not say anything but also not post anything and redirect to index.php, and, if the form was actually filled correctly, it just posts it and redirects to the index.php page.

What actually happened is, independently of filling it correctly or not, it just doesn't post and redirects to the index.php file without the post appearing.