Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include "config/koneksi.php";
- $seminar=$_POST['seminar'];
- $npm=$_POST['npm'];
- $judul=$_POST['judul'];
- $pembimbing1=$_POST['pembimbing1'];
- $pembimbing2=$_POST['pembimbing11'];
- $tgl1=$_POST['tanggal1'];
- $tgl2=$_POST['tanggal2'];
- $sql = mysql_query ("select count(npm) c from mahasiswa where npm ='$npm' and id_jurusan = '2'");
- $hasil = mysql_fetch_array ($sql);
- if ($hasil ['c']==0)
- {
- echo "<script>
- alert ('NPM ini bukan mahasiswa diploma')
- window.location='tugas_akhir.php'
- </script>";
- }
- else if (($pembimbing1)==($pembimbing2))
- {
- echo "<script>
- alert ('Pembimbing tidak boleh sama')
- window.location='tugas_akhir.php'
- </script>";
- }
- else if(($tgl2)<($tgl1))
- {
- echo "<script>
- alert ('Harap periksa waktu')
- window.location='tugas_akhir.php'
- </script>";
- }
- else
- {
- $cekdata="select npm from tugas_akhir where npm='$npm'";
- $ada=mysql_query($cekdata) or die(mysql_error());
- if(mysql_num_rows($ada)>0)
- { die("<script>
- alert ('Maaf, NPM ini sepertinya sudah ada di database')
- window.location='tugas_akhir.php'
- </script>");
- }
- else {
- $sql=mysql_query("insert into tugas_akhir (id_seminar,npm,judul ,nip1,nip2,tgl_ajukan_judul,tgl_lulus )
- values ('$seminar','$npm','$judul','$pembimbing1','$pembimbing2','$tgl1','$tgl2')");
- if ($sql)
- {
- echo "<script>
- alert ('Data tersimpan')
- window.location='lihat_tugas_akhir.php'
- </script>";
- }
- else
- {
- echo "<script>
- alert ('Data gagal tersimpan')
- window.location='lihat_tugas_akhir.php'
- </script>";
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement