fadilzteria

proses-pendaftaran 3

Nov 20th, 2018
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.02 KB | None | 0 0
  1. <?php
  2.  
  3. include("config.php"); ?>  
  4.  <script>  
  5.    function showsiswa() {  
  6.      if (window.XMLHttpRequest) {  
  7.        xhttp = new XMLHttpRequest();  
  8.      }  
  9.      xhttp.onreadystatechange = function() {  
  10.        if (this.readyState == 4 && this.status == 200){  
  11.        }  
  12.      };  
  13.      xhttp.open("GET", "index.html", true);  
  14.      xhttp.send();  
  15.    }  
  16.  </script>  
  17.  <?php  
  18.  
  19. if(isset($_POST['daftar'])) {  
  20.     $nama = $_POST['nama'];  
  21.     $alamat = $_POST['alamat'];  
  22.     $jk = $_POST['jenis_kelamin'];  
  23.     $agama = $_POST['agama'];  
  24.     $sekolah = $_POST['sekolah_asal'];  
  25.  
  26.     $sql = "INSERT INTO calon_siswa (nama, alamat, jenis_kelamin, agama,sekolah_asal) VALUE ('$nama', '$alamat', '$jk', '$agama', '$sekolah')";  
  27.     $query = mysqli_query($db, $sql);  
  28.  
  29.     if( $query ) {  
  30.       header('Location: index.php?status=sukses');
  31.     } else {  
  32.       header('Location: index.php?status=gagal');  
  33.     }  
  34. }    
  35. else {  
  36.    die("Akses dilarang...");  
  37. }
  38.  
  39. ?>
Advertisement
Add Comment
Please, Sign In to add comment