//taking inpur from user
if (isset($_POST['submit'])) {
$comment_content = $_POST['commentContent'];
//replace input by below code
$comment_content = str_ireplace('<','<',$comment_content);
$comment_content = str_ireplace('>','>',$comment_content);
//send data to database
$sql = "INSERT INTO comments (comment_content,comment_user,thread_id) VALUES
('$comment_content','$userName','$threadID')";
$ifSuccess = mysqli_query($conn,$sql);
if($ifSuccess){
echo 'successfully Saved to database';
}
}
0 Comments