try {
$con = new PDO("mysql:host=localhost; dbname=db_adi","root","");
$con-> exec("SET NAMES utf8mb4; SET CHARSET utf8mb4");
$con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
echo 'Bağlanamadı'. $e->getMessage();
}
if ($_POST) {
echo '';
// print_r($_POST);
$count = count($_POST);
$arr = [];
for ($i = 1; $i <= $count; $i++) {
$arr['cevap_'.$i] = implode(',', $_POST['cevap_'.$i]);
$ekle = $con->prepare("INSERT INTO tablo_adi (soru_id,cevap) VALUES (?,?)");
$ekle->execute([
$i,
implode(',', $_POST['cevap_'.$i])
]);
}
print_r($arr);
echo '
';
}
?>
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
Document