Advertisement
Guest User

ini budi

a guest
May 20th, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.86 KB | None | 0 0
  1. <?php
  2. $nama = $_POST['nama'];
  3. $usia= $_POST['aduan'];
  4. $kirim = $_POST['kirim'];
  5.  
  6. if (isset($kirim)) {
  7.     if (empty($nama) && empty($usia)) {
  8.         echo "<script>alert('silakan isi Nama dan usia anda');window.location = '../form.php';</script>";
  9.     } elseif (empty($nama)) {
  10.         echo "<script>alert('silakan isi Nama anda');window.location = '../form.php';</script>";
  11.     } elseif (empty($usia)) {
  12.         echo "<script>alert('silakan isi Aduan anda');window.location = '../form.php';</script>";
  13.     } else{
  14.  
  15.         $sql = "INSERT INTO tb_aduan (nama, aduan) VALUE ('$nama', '$aduan')";
  16.         //iki dinggo insert to nduwur iki
  17.         $hasil = $koneksi->query($sql);
  18.  
  19.         if($hasil) {
  20.             header('Location: ../beranda.php?status=sukses');
  21.         } else {
  22.             header('Location: ../beranda.php?status=gagal');
  23.         }
  24.     }
  25.  
  26. }
  27.  
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement