Rename and Delete

parent 5b571c27
<?php
require_once("koneksi.php");
include 'header.php';
?>
<!-- breadcrumbs -->
<div class="breadcrumbs">
<div class="container">
<ol class="breadcrumb breadcrumb1">
<li><span><i class="fa fa-sign-in" aria-hidden="true"></i><a href="login.php"> Masuk</a></span></li>
<li class="active">Form Kelola Artikel</li>
</ol>
</div>
</div>
<!-- //breadcrumbs -->
<!-- register -->
<div class="register">
<div class="container">
<h2>Form Tambah Data Artikel</h2>
<div class="login-form-grids">
<h5>Data Artikel</h5>
<form action="formarticle_process.php" method="POST">
<input type="text" name="judul_artikel" placeholder="Judul Artikel" required=" " ><br>
<textarea name="isi_artikel" placeholder="Isi Artikel" required=" "></textarea>
<input type="file" name="gambar_artikel" required=" ">
<input type="submit" name="tambah" value="tambah">
</form>
</div>
<div class="register-home">
<a href="index.php">Beranda</a>
</div>
</div>
</div>
<!-- //register -->
<?php
include 'footer.php';
?>
\ No newline at end of file
<?php
session_start();
include 'koneksi.php';
if(isset($_POST['tambah'])){
$username = $_SESSION['username'];
$profile = "";
$judul_artikel = $_POST['judul_artikel'];
$isi_artikel = $_POST['isi_artikel'];
$gambar_artikel = $_POST['gambar_artikel'];
if ($_FILES[$gambar_artikel]['name']) {
move_uploaded_file($_FILES[$gambar_artikel]['tmp_name'], 'images/' . $judul_artikel . '.jpg');
$profile = 'images/' . $judul_artikel . '.jpg';
}
$profile = 'images/' . $judul_artikel . '.jpg';
$tambah = mysql_query("INSERT INTO t_artikel VALUES('', '$judul_artikel', '$isi_artikel', NOW(), '$profile', '$username')") or die(mysql_error());
if($tambah) {
echo "<script>alert('Data buku $judul_artikel berhasil ditambahkan');'</script>";
}
else {
echo "<script>alert('Gagal menambahkan artikel !'); window.location = 'formarticle.php'</script>";
}
}
?>
\ No newline at end of file
<?php
require_once("koneksi.php");
include 'header.php';
?>
<!-- breadcrumbs -->
<div class="breadcrumbs">
<div class="container">
<ol class="breadcrumb breadcrumb1">
<li><span><i class="fa fa-sign-in" aria-hidden="true"></i><a href="login.php"> Masuk</a></span></li>
<li class="active">Form Kelola Buku</li>
</ol>
</div>
</div>
<!-- //breadcrumbs -->
<!-- register -->
<div class="register">
<div class="container">
<h2>Form Tambah Data Buku Baru</h2>
<div class="login-form-grids">
<h5>Data Buku</h5>
<form action="formbook_process.php" method="POST">
<input type="text" name="isbn" placeholder="ISBN" required=" " ><br>
<input type="text" name="judul" placeholder="Judul Buku" required=" " ><br>
<input type="text" name="pengarang" placeholder="Nama Pengarang" required=" " ><br>
<input type="text" name="penerbit" placeholder="Nama Penerbit" required=" " ><br>
<input type="text" name="kategori" placeholder="Kategori Buku" required=" " ><br>
<input type="text" name="tahun" placeholder="Tahun Terbit" required=" " ><br>
<input type="text" name="harga" placeholder="Harga per Eksemplar" required=" " ><br>
<input type="text" name="jumlah" placeholder="Jumlah Tersedia" required=" " ><br>
<input type="text" name="keterangan" placeholder="Keterangan Buku" required=" " ><br>
<input type="file" name="gambar" required=" ">
<input type="submit" name="tambah" value="tambah">
</form>
</div>
<div class="register-home">
<a href="index.php">Beranda</a>
</div>
</div>
</div>
<!-- //register -->
<?php
include 'footer.php';
?>
\ No newline at end of file
<?php
session_start();
include 'koneksi.php';
if(isset($_POST['tambah'])){
$isbn = $_POST['isbn'];
$judul = $_POST['judul'];
$pengarang = $_POST['pengarang'];
$penerbit = $_POST['penerbit'];
$kategori = $_POST['kategori'];
$tahun = $_POST['tahun'];
$harga = $_POST['harga'];
$jumlah = $_POST['jumlah'];
$keterangan = $_POST['keterangan'];
$gambar = $_POST['gambar'];
$tambah = mysql_query("INSERT INTO t_buku VALUES('$isbn', '$judul', '$pengarang', '$penerbit', '$kategori', '$tahun', '$harga', '$jumlah', '$gambar', '$keterangan')") or die(mysql_error());
if($tambah) {
echo "<script>alert('Data buku $judul berhasil ditambahkan');window.location = 'processbook.php '</script>";
}
else {
echo "<script>alert('Gagal menambahkan data buku !'); window.location = 'formbook.php'</script>";
}
}
?>
\ No newline at end of file
if(isset($_POST['edit'])){
$edit = mysql_query("UPDATE t_buku SET isbn='$isbn', judul='$judul', pengarang='$pengarang', penerbit='$penerbit', kategori='$kategori', tahun='$tahun', harga='$harga', jumlah='$jumlah', gambar='$gambar', keterangan='$keterangan'") or die(mysql_error());
if($edit) {
echo "<script>alert('Data buku $judul berhasil dibaharui');window.location = 'processbook.php '</script>";
}
else {
echo "<script>alert('Gagal membaharui data buku !'); window.location = 'formbook.php'</script>";
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment