GAGAL INSERT DATA

<?php

$conn = mysqli_connect("localhost","root","","db_penulis");

if (mysqli_connect_errno()) {

echo "Gagal terhubung ke database!";

exit();

}

?>

<html>

<head>

<title>Manipulasi Data Pada Tabel Master Buku</title>

</head>

<style>

body {

       background: -webkit-linear-gradient(bottom, #2dbd6e, #a6f77b);

       background-repeat: no-repeat;

}

#card {

        background: #fbfbfb;

        border-radius: 8px;

        box-shadow: 1px 2px 8px rgba(0, 0, 10, 10.65);

        height: 700px;

        margin: 6rem auto 8.1rem auto;

        width: 390px;

padding: 20px 60px;

text-align: center;

}

#card-content {

      padding: 12px 44px;

}

#card-title {

      font-family: "Raleway Thin", sans-serif;

      letter-spacing: 4px;

      padding-bottom: 23px;

      padding-top: 13px;

      text-align: center;

}

.underline-title {

      background: -webkit-linear-gradient(right, #a6f77b, #2ec06f);

      height: 2px;

      margin: -1.1rem auto 0 auto;

      width: 200px;

}

</style>

<body>

<div id="card">

<div id="card-content">

<div id="card-title">

<h2>INPUT DATA MASTER BUKU</h2>

<div class="underline-title"></div>

</div>

</div>

<form action="crud-masterbuku.php" method="get">

<strong>Kode Buku</strong><br>

<input type="text" name="kode_buku" maxlength="10" required><br><br>

<strong>Judul Buku</strong><br>

<input type="text" name="judul_buku" maxlength="30" required><br><br>

<strong>Kategori</strong><br>

<select name="kategori" required>

<option>- pilih kategori -</option>

<?php

$sql_kategori= mysqli_query($conn,"select * from tb_kategori order by nama_kategori asc")or die (mysqli_error($conn));

while($kategori = mysqli_fetch_array($sql_kategori)) {

echo '<option value="'.$kategori['nama_kategori'].'">'.$kategori['nama_kategori'].'</option>';

}

?>

</select><br><br>

<strong>Pengarang</strong><br>

<select name="pengarang" required>

<option value="">- pilih pengarang -</option>

<?php

$sql_pengarang= mysqli_query($conn,"select * from tb_pengarang order by nama_pengarang asc")or die (mysqli_error($conn));

while($pengarang = mysqli_fetch_array($sql_pengarang)) {

echo '<option value="'.$pengarang['nama_pengarang'].'">'.$pengarang['nama_pengarang'].'</option>';

}

?>

</select><br><br>

<strong>Penerbit</strong><br>

<select name="penerbit" required>

<option value="">- pilih penerbit -</option>

<?php

$sql_penerbit= mysqli_query($conn,"select * from tb_penerbit order by nama_penerbit asc")or die (mysqli_error($conn));

while($penerbit = mysqli_fetch_array($sql_penerbit)) {

echo '<option value="'.$penerbit['nama_penerbit'].'">'.$penerbit['nama_penerbit'].'</option>';

}

?>

</select><br><br>

<strong>Tahun</strong><br>

<input type="text" name="tahun" maxlength="4" required><br><br>

<strong>Deskripsi</strong><br>

<input type="text" name="deskripsi" required><br><br>

<strong>Harga</strong><br>

<input type="text" name="harga" required><br><br>

<input type="submit" name="simpan" value="SIMPAN"><br><br>

</form>

</div>

</body>

</html>

avatar haydiryahya_google
@haydiryahya_google

1 Kontribusi 0 Poin

Dipost 4 tahun yang lalu

Belum ada Jawaban. Jadi yang pertama Jawaban

Login untuk ikut Jawaban