-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit.php
52 lines (51 loc) · 1.43 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
49
50
51
52
<?php
require 'functions.php';
//menekan tombol cancel
if(isset($_POST['cancel'])){
header('Location:index.php');
}
$id = $_GET["id"];
$journal = query("SELECT * FROM journals WHERE id = '$id'");
$journal = $journal[0];
if(isset($_POST['edit'])){
var_dump(edit($_POST));
header('Location:index.php');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Journal | Edit</title>
</head>
<body>
<h1>
Edit Journal
</h1>
<form action="" method="POST">
<table border="1" cellspacing="0" cellpadding="">
<tr>
<td>
<input type="text" placeholder="title"name="title" id="title"width="100px" value="<?= $journal['title'] ?>">
<input type="hidden" name="id" value="<?= $journal['id'] ?>">
</td>
</tr>
<tr>
<td>
<textarea name="content" id="" cols="30" rows="10" placeholder="<?= $journal['content'] ?>"><?= $journal['content'] ?></textarea>
</td>
</tr>
<tr>
<td>
<button type="submit" name="edit" id="edit">Edit</button>
</td>
</tr>
</table>
</form>
<form action="" method="post">
<button type="submit" name="cancel" name="cancel" id="cancel">Go Back</button>
</form>
</body>
</html>