I'm currently trying to create a comment section on my website. The code is almost done but I have run into an issue. When submiting the text, it is not going to my database. Here is the code to take the text and send it to MySQL database.
<?php
include 'dbh.inc.php';
function setComments($conn) {
if(isset($_POST['commentSubmit'])){
$uid = $_POST['uid'];
$date = $_POST['date'];
$message = $_POST['message'];
$sql = "INSERT INTO comments (uid, date, message) VALUES ('$uid,
$date,
$message')";
$result = $conn->query($sql);
}
}
If you could provide me with an answer that would be great.