Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'lib/library.php';
- if ($_SERVER['REQUEST_METHOD'] == 'POST') {
- $nis = htmlspecialchars($_POST['nis']);
- $nama_lengkap = htmlspecialchars($_POST['nama_lengkap']);
- $jenis_kelamin = htmlspecialchars($_POST['jenis_kelamin']);
- $kelas = htmlspecialchars($_POST['id_kelas']);//INI!
- $jurusan = htmlspecialchars($_POST['jurusan']);
- $gol_darah = htmlspecialchars($_POST['gol_darah']);
- $alamat = htmlspecialchars($_POST['alamat']);
- $ibu_k = htmlspecialchars($_POST['ibu_k']);
- $foto = $_FILES['foto'];
- if (!empty($foto) AND $foto['error'] == 0) {
- $path = './images/';
- $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 = "INSERT INTO siswa (nis,nama_lengkap,jenis_kelamin,id_kelas,jurusan,gol_darah,alamat,ibu_k,file) VALUES //INI!
- ('$nis', '$nama_lengkap', '$jenis_kelamin', '$kelas', '$jurusan', '$gol_darah', '$alamat', '$ibu_k', '$file') ";
- $mysqli->query($sql) or die ($mysqli->error);
- header('location: index.php');
- }
- //Ambil data kelas
- $sql = "SELECT * FROM t_kelas";
- $datakelas = $mysqli->query($sql) or die($mysqli->error);
- include 'views/v_tambah.php';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment