<a href="index.php">Show Data</a>
<br><br>
	

<form method="post">
  <table>
    <tr>
      <td>NIDN</td>
      <td><input type="text" name="nidn" placeholder="Masukkan NIDN" required></td>
    </tr>
    <tr>
      <td>Nama</td>
      <td><input type="text" name="nama" placeholder="Masukkan Nama" required></td>
    </tr>
    <tr>
      <td>Jabatan</td>
      <td><input type="text" name="jabatan" placeholder="Masukkan Jabatan" required></td>
    </tr>
    <tr>
      <td>Program Studi</td>
      <td>
        <select name="program_studi" >
          <option value="D3 Teknologi Informasi">D3 Teknologi Informasi</option>
          <option value="D3 Teknologi Komputer">D3 Teknologi Komputer</option>
          <option value="D4 Teknologi Rekayasa Perangkat Lunak">D4 Teknologi Rekayasa Perangkat Lunak</option>
          <option value="S1 Informatika">S1 Informatika</option>
          <option value="S1 Sistem Informasi">S1 Sistem Informasi</option>
          <option value="S1 Teknik Elektro">S1 Teknik Elektro</option>
        </select>
      </td>
    </tr>
    <tr>
      <td>Golongan</td>
      <td><input type="text" name="golongan" placeholder="Masukkan golongan" required></td>
    </tr>
    <tr>
      <td>Pendidikan</td>
      <td><input type="text" name="pendidikan" placeholder="Masukkan Pendidikan" required></td>
    </tr>
    <tr>
      <td>Tahun Mulai S1</td>
      <td><input type="date" name="mulai_s1"></td>
    </tr>
    <tr>
      <td>Tahun Lulus S1</td>
      <td><input type="date" name="lulus_s1"></td>
    </tr>
    <tr>
      <td>Tahun Mulai S2</td>
      <td><input type="date" name="mulai_s2"></td>
    </tr>
    <tr>
      <td>Tahun Lulus S2</td>
      <td><input type="date" name="lulus_s2"></td>
    </tr>
    <tr>
      <td>Username</td>
      <td><input type="username" name="username" placeholder="Masukkan Username" required></td>
    </tr>
    <tr>
      <td>Password</td>
      <td><input type="password" name="password" placeholder="Masukkan Password" required></td>
    </tr>
    <tr>
      <td>Email</td>
      <td><input type="email" name="email" placeholder="Masukkan email" required></td>
    </tr>
    <tr>
      <td><input type="submit" name="add" value="Add"></td>
      <td><input type="reset" name="reset" value="Cancel"></td>
    </tr>
  </table>
</form>


<?php
if(isset($_POST['add']))
{
include 'config.php';

  $nidn = $_POST['nidn'];
  $nama = $_POST['nama'];
  $jabatan = $_POST['jabatan'];
  $program_studi = $_POST['program_studi'];
  $golongan = $_POST['golongan'];
  $pendidikan = $_POST['pendidikan'];
  $mulai_s1 = $_POST['mulai_s1'];
  $lulus_s1 = $_POST['lulus_s1'];
  $mulai_s2 = $_POST['mulai_s2'];
  $lulus_s2 = $_POST['lulus_s2'];
  $username = $_POST['username'];
  $password = $_POST['password'];
  $email = $_POST['email'];
 
  $sql="INSERT INTO dosen (nidn, nama, jabatan, program_studi, golongan, pendidikan, mulai_s1, lulus_s1, mulai_s2, lulus_s2, username, password, email) VALUES ('$nidn','$nama','$jabatan','$program_studi','$golongan', '$pendidikan', '$mulai_s1', '$lulus_s1', '$mulai_s2', '$lulus_s2', '$username', '$password', '$email')";
  if($conn->query($sql) === false)
  { 
    trigger_error('Wrong SQL Command: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
  }  
  else 
  { 
    echo "<script>alert('Add Success!')</script>";
  	echo "<meta http-equiv=refresh content=\"0; url=index.php\">";
  }
}

?>   