01.
<?php
02.
03.
$stmt
=
$conn
->prepare("SELECT tb_incident_rep.*, tb_section.section_name_thai
04.
FROM tb_incident_rep
05.
LEFT JOIN tb_section ON tb_incident_rep.dep_effect = tb_section.id");
06.
$stmt
->execute();
07.
$rs
=
$stmt
->fetchAll();
08.
09.
?>
10.
<select name=
"dep_effect"
class
=
"form-control form-control-sm"
>
11.
<option selected disabled>Select one</option>
12.
13.
<?php
foreach
(
$rs
as
$row
) { ?>
14.
<option <?=(
$row
[
"tb_incident_rep.dep_effect"
]==
$value
?
'selected'
:
''
)?> ><?php
echo
15.
$row
[
"section_name_thai"
]; ?></option>
16.
17.
<?php } ?>
18.
19.
</select>