-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit.php
executable file
·48 lines (38 loc) · 1.24 KB
/
edit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
require_once "core/init.php";
require_once "view/header.php";
if(isset($_GET['id'])){
$blog = new Blog();
$edit = $blog->editBlog($_GET['id']);
$edit = $edit->fetch(PDO::FETCH_OBJ);
?>
<style>
body{
background-image: url("view/gambar/admin.jpg");
}
</style>
<div class="add-article">
<form action="edit.php" method="POST" class="artikel">
<label for="judul">Judul</label>
<input type="hidden" name="id" value="<?="$edit->id";?>">
<input type="text" name="judul" placeholder="Judul" value="<?="$edit->judul";?>">
<label for="isi">Artikel</label>
<textarea name="isi" cols="65%" rows="10" autofocus><?="$edit->isi";?></textarea>
<h3 style="color: white;">Kategori : <?="$edit->nama_kategori";?></h3>
<input type="submit" name="updateBlog" value="Update">
<input type="reset" value="Reset">
</form>
</div>
<?php
}
if (isset($_POST['updateBlog'])) {
$id = $_POST['id'];
$judul = $_POST['judul'];
$isi = $_POST['isi'];
$updt = new Blog();
$update = $updt->updateBlog($id, $judul, $isi);
if ($update == "Success") {
header('Location: add.php');
}
}
?>