-
Notifications
You must be signed in to change notification settings - Fork 1
/
book-form.php
54 lines (45 loc) · 1.4 KB
/
book-form.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
53
54
<?php
require_once dirname(__FILE__) . '/library/base.php';
$id = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT);
$title = null;
$author = null;
if ($id) {
$book = $bookshelf->find($id);
$title = $book['title'];
$author = $book['author'];
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Bookshelf</title>
</head>
<body>
<h1>Bookshelf</h1>
<p>
<a href="/">Home</a>
</p>
<form method="post" action="process-book.php">
<input type="hidden" id="id" name="id" value="<?php echo $id; ?>" />
<dl>
<dt>
<label for="title">Title</label>
</dt>
<dd>
<input type="text" id="title" name="title" value="<?php echo $title; ?>" />
</dd>
<dt>
<label for="author">Author</label>
</dt>
<dd>
<input type="text" id="author" name="author" value="<?php echo $author; ?>" />
</dd>
<dt> </dt>
<dd>
<input type="submit" value="Submit" />
</dd>
</dl>
</form>
</body>
</html>