Menu

Senin, 02 September 2019

Materi 4 : membuat file simpan.php

<?php
include "koneksi.php";
      $id = $_POST['id'];
      $nama = $_POST['nama'];
      $alamat = $_POST['alamat'];
      $tahun = $_POST['tahun'];
      $kelas = $_POST['kelas'];
      $rombel = $_POST['rombel'];
      $sql = "Insert Into siswa values('$id','$nama','$alamat','$tahun','$kelas','$rombel')";
if(mysqli_query($dbconnect, $sql)){
    echo "Records inserted successfully.";
     echo "<script> location.replace('tampil.php'); </script>";
} else{
    echo "ERROR: Could not able to execute $sql. " . mysqli_error($dbconnect);
}
// Close connection
mysqli_close($dbconnect);
?>

Tidak ada komentar:

Posting Komentar

Komentarlah dengan bijak no Spam