Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <h1 class="page-header"> <span class="glyphicon glyphicon-user"></span>   Input Data Siswa</h1>
- <div class="row placeholders well">
- <div id="error" class="alert alert-info">
- <a href="#" class="close" data-dismiss="alert">×</a>
- <strong>ERROR</strong> Please read the comments carefully.
- </div>
- <div id="success" class="alert alert-info">
- <a href="#" class="close" data-dismiss="alert">×</a>
- <strong>SUCCESS!</strong> Please read the comments carefully.
- </div>
- <div class="col-sm-offset-3">
- <br/><br/><br/>
- <form class="form-horizontal" method="post" action="" enctype="multipart/form-data">
- <div class="form-group">
- <label for="inputPassword3" class="col-sm-2 control-label">Nama</label>
- <div class="col-sm-5">
- <input type="text" class="form-control" placeholder="Nama" name="nama" required />
- </div>
- </div>
- <div class="form-group">
- <label for="inputPassword3" class="col-sm-2 control-label">No Induk</label>
- <div class="col-sm-5">
- <input type="text" class="form-control" placeholder="No Induk " name="no_induk" required />
- </div>
- </div>
- <div class="form-group">
- <label for="inputPassword3" class="col-sm-2 control-label">Foto</label>
- <div class="col-sm-5">
- <input type="file" class="form-control" placeholder="Mata Pelajaran" name="foto" />
- </div>
- </div>
- <div class="form-group">
- <label for="inputPassword3" class="col-sm-2 control-label">Jurusan</label>
- <div class="col-sm-5">
- <input type="text" class="form-control" placeholder="jurusan" name="jurusan" required />
- </div>
- </div>
- <div class="form-group">
- <label for="inputPassword3" class="col-sm-2 control-label">Kelas</label>
- <div class="col-sm-5">
- <input type="text" class="form-control" placeholder="Kelas" name="kelas" required />
- </div>
- </div>
- <input type="hidden" class="form-control" placeholder="jurusan" name="password" value="polke" required />
- <div class="form-group">
- <div class="col-sm-offset-1 col-sm-6">
- <button type="submit" name="submit" class="btn btn-primary btn-lg">Input Soal</button>
- </div>
- </div>
- </form>
- </div>
- </div>
- <?php
- if(isset($_POST['submit'])){
- $nama =$_POST['nama'];
- $no_induk =$_POST['no_induk'];
- $foto =$_FILES['foto']['name'];
- $jurusan =$_POST['jurusan'];
- $kelas =$_POST['kelas'];
- $password =$_POST['password'];
- $folder = "foto/";
- $folder = $folder .basename($_FILES['foto']['name']);
- $sql ="INSERT INTO `tbl_siswa` VALUES ('','$no_induk','$nama','$foto','$jurusan','$kelas',md5('$password'))";
- $query = mysql_query($sql);
- if($query){
- move_uploaded_file($_FILES['foto']['tmp_name'], $folder);
- ?>
- <script type="text/javascript">
- $(document).ready(function(){
- $(".close").click(function(){
- $("#succes").alert();
- });
- });
- window.location="index2.php?halaman=input_siswa";
- </script>
- <?php
- }else{
- ?>
- <script type="text/javascript">
- $(document).ready(function(){
- $(".close").click(function(){
- $("#error").alert();
- });
- });
- window.location="index2.php?halaman=input_siswa";
- </script>
- <?php
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment