richard2803
Forum Replies Created
-
is it work for my snippet codes? I think i got a same problem on my wordpress after I used this snippet and I get blank page with “Koneksi gagal” words on every pages of my wordpress
*sorry for my bad english, I hope u understand what I mean:)
This my snippet codes.
$host =”localhost”; //host server
$user =”aqiqahbe”; //user login phpMyAdmin
$pass =”1Cgf5kO1n5″; //pass login phpMyAdmin
$db =”aqiqahbe_orderan”; //nama database
$conn = mysqli_connect($host, $user, $pass, $db) or die (“Koneksi gagal”);if($_SERVER[‘REQUEST_METHOD’] == “POST”){
$name = $_REQUEST[‘nama’];
$pkt = $_REQUEST[‘paket’];
$tlp = $_REQUEST[‘telp’];
$imail = $_REQUEST[’email’];
$hr = $_REQUEST[‘tanggal’];
$jam = $_REQUEST[‘waktu’];
$alm = $_REQUEST[‘alamat’];
$cttn = $_REQUEST[‘catatan’];
$submit = $_REQUEST[‘submit’];function ubahTanggal($hr){
$pisah = explode(‘/’,$hr);
$array = array($pisah[2],$pisah[0],$pisah[1]);
$satukan = implode(‘-‘,$array);
return $satukan;
}$tgl = ubahTanggal($hr);
$mysqli = “INSERT INTO order_tabel (nm, paket, tlp, mail, tgl, wkt, addr, note) VALUES (‘$name’, ‘$pkt’, ‘$tlp’,’$imail’,’$tgl’,’$jam’,’$alm’,’$cttn’)”;
if(isset($submit)){
if(empty($name) or empty($pkt) or empty($tlp) or empty($tgl) or empty($jam) or empty($alm)){
echo “<script>window.alert(‘Maaf, form tidak boleh kosong…’)</script>”;
} else {
$result = mysqli_query($conn, $mysqli);
}
if ($result) {
echo ”<center>Pemesanan berhasil
Silakan segera hubungi kontak kami untuk konfirmasi pemesanan</center>”;
} else {
echo “<center>Pemesanan gagal
Mohon coba lagi</center>”;
}
}
mysqli_close($conn);
}