<?php
$hostname = "localhost";
$username = "idzx4953_minzi";
$password = "Minzi2828#";
$db_name = "idzx4953_idzi";

$db = new mysqli($hostname, $username, $password, $db_name);

if ($db->connect_error) {
    echo "Koneksi Error, Periksa DB anda!";
}

$waktu = $_POST['waktu'];
$idtamu = $_POST['idtamu'];
$idpengantin = $_POST['idpengantin'];
$nama = $_POST['nama'];
$isi = $_POST['isi'];
$konfirmasi = $_POST['konfirmasi'];
$tamu = $_POST['tamu'];

$sql = "INSERT INTO `ucapan`(`iducapan`, `waktu`, `nama`, `isi`, `idpengantin`, `konfirmasi`, `tamu`) VALUES (Null,'$waktu','$nama','$isi','$idpengantin', '$konfirmasi', '$tamu')";

$result = $db->query($sql);

if ($result === TRUE) {
    header("Location:index.php?to=$nama");
} else {
    header("Location:Location:index.php?to=$nama");
}
?>