01.
<form action=
"aformAdd_db.php"
method=
"post"
>
02.
<div
class
=
"mb-2 row"
>
03.
<div
class
=
"col-sm-12"
>
04.
<select name=
"type_id"
class
=
"form-control"
required>
05.
<option value=
""
>-เลือกประเภทหนังสือ-</option>
06.
<?php
07.
$stmt
=
$conn
->prepare(
"SELECT* FROM typebook"
);
08.
$stmt
->execute();
09.
$result
=
$stmt
->fetchAll();
10.
foreach
(
$result
as
$row
) {
11.
?>
12.
<option value=
"<?= $row['type_id'];?>"
>-<?=
$row
[
't_name'
];?></option>
13.
<?php } ?>
14.
</select>
15.
</div></div>
16.
<div
class
=
"mb-2 row"
>
17.
<div
class
=
"col-sm-3"
>
18.
<input type=
"text"
name=
"Numberbk"
pattern=
"[0-9]{1,}"
title=
"กรอกตัวเลขเท่านั้น"
class
=
"form-control"
required maxlength=
"5"
placeholder=
"เลขที่หนังสือออก"
>
19.
</div>
20.
<!-- </div>
21.
<div
class
=
"mb-2"
> -->
22.
<div
class
=
"col-sm-3"
>
23.
<input type=
"text"
name=
"Yearbk"
class
=
"form-control"
readonly=
"readonly"
value=
"<?php echo thaidate('/Y'); ?>"
>
24.
</div>
25.
<div
class
=
"col-sm-6"
>
26.
<input type=
"text"
name=
"datebk"
class
=
"form-control"
readonly=
"readonly"
value=
"<?php echo thaidate('j F Y'); ?>"
>
27.
</div>
28.
</div>
29.
<div
class
=
"mb-2 row"
>
30.
<div
class
=
"col-sm-12"
>
31.
<input type=
"text"
name=
"Sudbk"
class
=
"form-control"
required maxlength=
"100"
placeholder=
"เรื่อง"
>
32.
</div>
33.
</div>
34.
<div
class
=
"mb-2 row"
>
35.
<div
class
=
"col-sm-6"
>
36.
<input type=
"text"
name=
"NameFrom"
class
=
"form-control"
required maxlength=
"50"
placeholder=
"ชื่อผู้ส่ง"
>
37.
</div>
38.
<div
class
=
"col-sm-6"
>
39.
<input type=
"text"
name=
"NameTo"
class
=
"form-control"
required maxlength=
"50"
placeholder=
"ผู้รับ (ชื่อบุคคล/หน่วยงาน)"
>
40.
</div>
41.
</div>
42.
<div
class
=
"mb-2 row"
>
43.
<div
class
=
"col-sm-3"
>
44.
<input type=
"text"
name=
"posFrom"
class
=
"form-control"
required maxlength=
"50"
placeholder=
"แผนก/สังกัด"
>
45.
</div>
46.
<div
class
=
"col-sm-3"
>
47.
<input type=
"text"
name=
"phonefrom"
class
=
"form-control"
maxlength=
"4"
placeholder=
"เบอร์ติดต่อภายใน"
>
48.
</div>
49.
<div
class
=
"col-sm-6"
>
50.
<input type=
"text"
name=
"phoneto"
class
=
"form-control"
maxlength=
"20"
placeholder=
"เบอร์โทรบุคคล/หน่วยงาน(ที่รับ)"
>
51.
</div>
52.
</div>
53.
<div
class
=
"mb-2 row"
>
54.
<div
class
=
"col-sm-6"
>
55.
<input type=
"text"
name=
"nameby"
class
=
"form-control"
required maxlength=
"10"
placeholder=
"ชื่อผู้ขอเลข"
>
56.
</div>
57.
58.
</div>
59.
60.
</div>
61.
<div
class
=
"mb-2 row"
>
62.
<div
class
=
"d-grid gap-2 col-sm-12 mb-3"
>
63.
<button type=
"submit"
class
=
"btn btn-primary"
>เพิ่มข้อมูล</button>
64.
</div>
65.
</div>
66.
</form>
67.
<h5>รายชื่อพนักงาน</h5>
68.
<table
class
=
"table table-striped table-hover table-responsive table-bordered"
>
69.
<thead>
70.
<tr>
71.
<th width=
"5%"
>ลำดับ</th>
72.
<th width=
"25%"
>หนังสือ</th>
73.
<th width=
"25%"
>เลขที่</th>
74.
<th width=
"25%"
>ผู้ส่ง</th>
75.
<th width=
"20%"
>วันที่ขอ</th>
76.
</tr>
77.
</thead>
78.
<tbody>
79.
<?php
80.
$stmtEmp
=
$conn
->prepare(
"SELECT b.*, t.t_name FROM bookout_2565 AS b INNER JOIN typebook AS t ON b.Typebk=t.type_id ORDER BY b.bookID DESC"
);
81.
$stmtEmp
->execute();
82.
$resultEmp
=
$stmtEmp
->fetchAll();
83.
foreach
(
$resultEmp
as
$rowEmp
) {
84.
?>
85.
<tr>
86.
<td><?=
$rowEmp
[
'bookID'
];?></td>
87.
<td><?=
$rowEmp
[
't_name'
];?></td>
88.
<td><?=
$rowEmp
[
'Numberbk'
];?><?=
$rowEmp
[
'Yearbk'
];?></td>
89.
<td><?=
$rowEmp
[
'NameFrom'
];?></td>
90.
<td><?=
$rowEmp
[
'datebk'
];?></td>
91.
</tr>
92.
<?php } ?>
93.
</tbody>
94.
</table>
95.
96.
</div>
97.
</div>
98.
</div>