<!doctype html>
<html lang="en">
    <head>
        <!-- Required meta tags -->
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <!-- Bootstrap CSS -->
        <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
        <link rel="stylesheet" href="css-style.css">
        <link rel="stylesheet" href="fontawesome/fontawesome-free-5.15.4-web/css/all.min.css">

        <title>INSTALL | Simari KING</title>
    </head>
    <body style="background-image: url(image/bg-3.jpeg); background-size: cover;">
        <div class="container text-light" style="background-color: rgba(8, 8, 8, 0.493); width: 30em;">
            <div class="pt-3 text-center text-warning" style="font-family: Impact; -webkit-text-stroke: 0.1em #000;">
                <h2><i class="fas fa-user"></i> PERMOHONAN INFORMASI</h2><hr class="hr text-light">
            </div> 

            <div class="row pt-2 gx-4 gy-4" style="font-size: 14px; font-family: Cambria; font-weight: bold;">
                <form method="POST">
                    <!-- form file -->
                    <label>Nama Lengkap</label>
                    <input type="text" name="nama" id="nama" class="form-control form-control-sm mb-1" placeholder="Nama Lengkap"/>
                    <label>Pekerjaan</label>
                    <input type="text" name="pekerjaan" id="pekerjaan" class="form-control form-control-sm mb-1" placeholder="Pekerjaan"/>
                    <label>Nama Institusi</label>
                    <input type="text" name="nama-ins" id="nama-ins" class="form-control form-control-sm mb-1" placeholder="Nama Institusi"/>
                    <label>Alamat</label>
                    <textarea type="text" name="alamat" id="alamat" class="form-control form-control-sm mb-1" placeholder="Alamat"></textarea>
                    <label>Nomor Telpon/WhatsApp</label>
                    <input type="text" name="telp" id="telp" class="form-control form-control-sm mb-1" placeholder="No. Telpon/WhatsApp"/>
                    <label>Email</label>
                    <input type="text" name="email" id="email" class="form-control form-control-sm mb-1" placeholder="Email"/>
                    <label>Rincian Informasi yang DIbutuhkan</label>
                    <textarea type="text" name="informasi" id="informasi" class="form-control form-control-sm mb-1" placeholder="Rincian Informasi"></textarea>
                    <label>Tujuan Penggunaan Informasi</label>
                    <textarea type="text" name="tujuan" id="tujuan" class="form-control form-control-sm mb-1" placeholder="Tujuan Penggunaan Informasi"></textarea>
                    <button type="submit" name="insert" id="insert" class="btn btn-danger mt-2 mb-4"><i class="fas fa-save"></i> KIRIM DATA</button>
                    <button type="submit" name="close" id="close" class="btn btn-warning mt-2 mb-4"><i class="fas fa-sign-out-alt"></i><a href="index.html"> KEMBALI </a></button>
                    <!-- end file -->
                </form>
            </div>
        </div>

    <!-- javascrip -->
    <script src="js/homepage.js" type="text/javascrip"></script>

    </body>
</html>

<!-- save coding -->
<?php
if (isset($_POST['insert']))
{
include 'config.php';
$tgl=date("Y-m-d");
    $nama = $_POST['nama']; 
	$pekerjaan = $_POST['pekerjaan'];
	$institusi = $_POST['nama-ins'];
    $alamat = $_POST['alamat'];
    $email = $_POST['email'];  
	$telp = $_POST['telp'];
	$informasi = $_POST['tujuan'];
	$tujuan = $_POST['tujuan'];  

    $query = "INSERT INTO tb_informasi(nama, tgl_permohonan, pekerjaan, instansi,  alamat, telp, email, rincian, tujuan, cara_memperoleh, cara_mendapatkan) 
    VALUES ('$nama', '$tgl', '$pekerjaan', '$institusi', '$alamat', '$telp', '$email', '$informasi', '$tujuan', 'mendapat salinan informasi', 'email')";
    $simpan = mysqli_query($koneksi, $query);
    echo "<script>alert('Data Telah Terkirim dan Akan Diperoses, Informasi akan disampaikan melalui telpon atau email')</script>";
    header("location: index.html");
}
?>
<!-- end save coding -->