I am following a tutorial series (Link to Video) in which I am learning to create a comments section to a web page. I am using XAMPP as it is what the guy in the video is using. I have finished writing the code which sends the data (name, time, message) to the database and when I go to try it out nothing happens. I checked the database and there is nothing
This is the code:
index.php
<?php
date_default_timezone_set('Europe/London');
include 'dbh.inc.php';
include 'comments.inc.php';
?>
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<?php
echo"<form method='POST' action='".setComments($conn)."'>
    <input type='hidden' name='uid' value='Anonymous'>
    <input type='hidden' name='date' value='".date('D-m-y H:i:s')."'>
    <textarea name='message'></textarea> <br>
    <button type='submit' name='commentSubmit'>Comment</button>
</form>";
?>
</body>
</html>
comments.inc.php
<?php
function setComments($conn) {
    if (isset($_POST['commentSubmit'])) {
        $uid = $_POST['uid'];
        $date = $_POST['date'];
        $message = $_POST['message'];
        $sql = "INSTERT INTO comments (uid, date, message) VALUES ('$uid', '$date', '$message')";
        $result = mysql_query(- $sql);
    }   
}
dbh.inc.php
<?php
$conn = mysqli_connect('localhost', 'root', '', 'commentsection');
if (!$conn) {
    die("Connection Faild: ".mysql_connect_error());
}
Please help me. thank you
 
     
     
    