-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathedit.php
62 lines (56 loc) · 1.97 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
53
54
55
56
57
58
59
60
61
62
<?php
require_once 'DbManager.php';
try {
$db = getDb();
if (empty($_GET['id'])) throw new Exception("蔵書番号が指定されていません");
$ID = (int) $_GET['id'];
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "SELECT * from 一般 WHERE 蔵書番号 = ?";
$stmt = $db->prepare($sql);
$stmt->bindValue(1, $ID, PDO::PARAM_INT);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$db = null;
} catch (Exception $e) {
echo "エラーが発生しました: " . htmlspecialchars($e->getMessage(), ENT_QUOTES, 'UTF-8') . "";
die();
}
?>
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>蔵書情報更新</title>
</head>
<body>
<h1>編集</h1>
<br>
<form method="post" action="update_data.php">
タイトル:
<br>
<input type="text" name="タイトル" size="150" value="<?php echo htmlspecialchars($result['タイトル'], ENT_QUOTES, 'UTF-8'); ?>">
<br>
著者:
<br>
<input type="text" name="著者" size="150" value="<?php echo htmlspecialchars($result['著者'], ENT_QUOTES, 'UTF-8'); ?>">
<br>
イラスト:
<br>
<input type="text" name="イラスト" size="150" value="<?php echo htmlspecialchars($result['イラスト'], ENT_QUOTES, 'UTF-8'); ?>">
<br>
出版:
<br>
<input type="text" name="出版" size="150" value="<?php echo htmlspecialchars($result['出版'], ENT_QUOTES, 'UTF-8'); ?>">
<br>
種別:
<br>
<input type="text" name="種別" size="150" value="<?php echo htmlspecialchars($result['種別'], ENT_QUOTES, 'UTF-8'); ?>">
<br>
<input type="hidden" name="蔵書番号" value="<?php echo htmlspecialchars($result['蔵書番号'], ENT_QUOTES, 'UTF-8'); ?>">
<br>
<br>
<input type="submit" value="登録">
</form>
</body>
</html>