-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathedit-view.php
More file actions
60 lines (50 loc) · 1.55 KB
/
edit-view.php
File metadata and controls
60 lines (50 loc) · 1.55 KB
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
53
54
55
56
57
58
59
60
<?php
require_once 'include/common.php';
require_once 'include/protect.php';
$dao = new BookDAO();
$book = new Book();
if (isset($_GET['id'])) {
$book = $dao->retrieve($_GET['id']);
} else if (isset($_POST['title'])) {
$book->title = $_REQUEST['title'];
$book->isbn13 = $_REQUEST['isbn13'];
$book->price = $_REQUEST['price'];
}
?>
<html>
<body>
<?php include 'header.php' ?>
<h1>Edit Book</h1>
<?php printErrors(); ?>
<form id='edit-form' action='edit.php' method='post'>
<table>
<tr>
<td>
Title
</td>
<td>
<input type='text' name='title' value='<?php echo htmlspecialchars($book->title, ENT_QUOTES, 'UTF-8');?>' />
</td>
</tr>
<tr>
<td>
ISBN13
</td>
<td>
<?php echo $book->isbn13; ?>
<input type='hidden' name='isbn13' value='<?php echo $book->isbn13; ?>' />
</td>
</tr>
<tr>
<td>
Price
</td>
<td>
<input type='text' name='price' value='<?php echo $book->price; ?>' />
</td>
</tr>
</table>
<input type='submit' />
</form>
</body>
</html>