gundambison

sy gk biasa edit di github

Dec 23rd, 2015
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 KB | None | 0 0
  1. <?php
  2. /**
  3. coba cek koneksi nya.. valid atau tidak
  4. **/
  5.     $judul = $_POST['judul'];
  6.     $penerbit = $_POST['penerbit'];
  7.     $tahun = $_POST['tahun'];
  8.     $query_string = "insert into buku (judul, penerbit, thn_terbit) values ('$judul', '$penerbit', '$tahun')";
  9.     $query = mysqli_query($koneksi, $query_string);
  10.     if($query) {
  11.         echo    "<script>
  12.                     window.alert('Sukses');
  13.                     window.location.href='location:index.php?madyan_go=edit';
  14.                 </script>";
  15.     } else {
  16.         $lokasi = 'location:index.php?madyan_go=edit';
  17.         echo    "<script>
  18.                     window.alert('Gagal tambah data');
  19.                     //window.location.href='location:index.php?madyan_go=edit';
  20.                 </script>";
  21.         printf("Error: %s\n", mysqli_error($koneksi));
  22.  
  23.         //header($lokasi);
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment