<div class="row">
    <div class="col-md-12 mb-4">
        <div class="card shadow mb-4">
            <div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
                <h6 class="m-0 font-weight-bold  ">Tambah Gejala</h6>
            </div>
            <div class="card-body">
                <form method="post" enctype="multipart/form-data">
                    <div class="form-group">
                        <label>Kode Gejala</label>
                        <input type="text" class="form-control" name="kodegejala" required>
                    </div>
                    <div class="form-group">
                        <label>Nama Gejala</label>
                        <textarea type="text" class="form-control" name="gejala" required></textarea>
                    </div>
                    <button type="submit" class="btn btn-primary" name="save"><i class="glyphicon glyphicon-saved"></i>Simpan</button>
                </form>
            </div>
        </div>
    </div>
</div>

<?php
if (isset($_POST['save'])) {
    // Menggunakan mysqli_real_escape_string untuk menghindari SQL injection
    $gejala = mysqli_real_escape_string($koneksi, $_POST['gejala']);
    $kodegejala = mysqli_real_escape_string($koneksi, $_POST['kodegejala']);

    $koneksi->query("INSERT INTO gejala (kodegejala, gejala) VALUES('$kodegejala', '$gejala')");

    // Menampilkan pesan sukses dan mengarahkan ke halaman pengurus
    echo "<script>alert('Data Berhasil Disimpan');</script>";
    echo "<script>location ='index.php?halaman=gejaladaftar';</script>";
}
?>