Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'lib/library.php';
- $nis = $_GET['nis'];
- if($_SERVER ['REQUEST_METHOD'] == 'POST'){
- $nis = $_POST['nis'];
- $nama_lengkap = $_POST['nama'];
- $gender = $_POST['gender'];
- $kelas = $_POST['kelas'];
- $jurusan = $_POST['jurusan'];
- $alamat = $_POST['alamat'];
- $gd = $_POST['GD'];
- $ibu = $_POST['ibu'];
- $file = $_POST['foto'];
- $foto = $_FILES['foto'];
- if(!empty($foto) AND $foto['error'] == 0){
- $path = './Media/image/';
- $upload = move_uploaded_file($foto['tmp_name'], $path . $foto['name']);
- if(!$upload){
- flash('error', "Upload File Gagal");
- header('location:index.php');
- }
- $file = $foto['name'];
- }
- $sql = "UPDATE siswa SET NIS = '$nis',
- nama_lengkap = '$nama_lengkap',
- gender = '$gender',
- kelas = '$kelas',
- jurusan = '$jurusan',
- Alamat = '$alamat',
- Golongan_Darah = '$gd',
- file = '$file',
- Nama_Ibu_Kandung = '$ibu' WHERE NIS = '$nis'";
- if($mysqli->query($sql)){
- flash('success', "Data berhasil diubah");
- }
- $mysqli -> query($sql) or die ($mysqli->error);
- header ('location: index.php');
- }
- if (empty($nis)) header('location: index.php');
- $sql = "SELECT * FROM siswa WHERE NIS = '$nis'";
- $query = $mysqli -> query($sql);
- $siswa = $query -> fetch_array();
- if(empty($siswa)) header('location : index.php');
- include 'view/v_tambah.php';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement