ı'm using a code block which ı already used in a different insert data process, but ı don't know why, it doesn't work. it sends me contact.php?in=error. what is the problem with my codes?
<?php
if(@$_POST['submit']){
$gizlicap = $_POST['hcaptcha'];
$code = $_POST['captcha'];
if($code == $gizlicap){
$name = htmlspecialchars($_POST['ad'], ENT_QUOTES, 'utf-8');
$email = htmlspecialchars($_POST['eposta'], ENT_QUOTES, 'utf-8');
$yazi = htmlspecialchars($_POST['text'], ENT_QUOTES, 'utf-8');
$snd = $db->prepare("INSERT INTO `contactform` (`message_id`, `message_ad`, `message_email`, `message`) VALUES (NULL, :ad, :email, :yazi) ");
$snd->bindValue(":ad", $name, PDO::PARAM_STR);
$snd->bindValue(":email", $email, PDO::PARAM_STR);
$snd->bindValue(":yazi", $yazi, PDO::PARAM_STR);
if($snd->execute()) {
@header("Location: contact.php?in=success");
} else {
@header("Location: contact.php?in=error");
}
} else {
echo 'Check security code!!';
}
}
?>