forked from allenshih1/database
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcountry_management.php
More file actions
48 lines (48 loc) · 1.21 KB
/
country_management.php
File metadata and controls
48 lines (48 loc) · 1.21 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
<?php require_once("header.php"); ?>
<h1>國家管理</h1>
<?php
if(isset($_SESSION['isAuth']) && $_SESSION['isAdmin'])
{
require_once("db.php");
$sql = "SELECT * FROM Country";
$airports = $db->prepare($sql);
$airports->execute();
?>
<table style="width:800px">
<tr>
<td> abbreviation </td>
<td> name </td>
</tr>
<?php
while($airport = $airports->fetchObject())
{
?>
<tr>
<td> <?= $airport->abbr ?> </td>
<td> <?= $airport->name ?> </td>
<form action="edit_country.php" method="post">
<input type="hidden" name="id" value="<?= $airport->id ?>">
<input type="hidden" name="abbr" value="<?= $airport->abbr ?>">
<input type="hidden" name="name" value="<?= $airport->name ?>">
<td> <button type="submit"> 編輯 </button></td>
</form>
<form action="delete_country_func.php" method="post">
<input type="hidden" name="id" value="<?= $airport->id ?>">
<td> <button type="submit"> 刪除 </button></td>
</form>
</tr>
<?php } ?>
</table>
<a href="add_country.php"> <button type="button">新增</button></a>
<?php
} else if(isset($_SESSION['isAuth'])){
?>
permission denied
<?php
} else {
?>
please login first
<?php
}
?>
<?php require_once("footer.php"); ?>