-
Notifications
You must be signed in to change notification settings - Fork 0
/
country.php
82 lines (73 loc) · 3.59 KB
/
country.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Countries Details</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
</head>
<body>
<div id="header" class="bg-dark text-white text-center py-2" style="font-size: 20px;">
COVID-19 DETAILS
</div>
<!-- Navigation section -->
<div class="text-end p-3">
<a href="home.php" class="l1 mx-2" style="font-size: 16px;">Home</a>
<a href="country.php" class="l1 mx-2" style="font-size: 16px;">Country & City</a>
<a href="covid19.php" class="l1 mx-2" style="font-size: 16px;">Europe</a>
<a href="covid19chart.php" class="l1 mx-2" style="font-size: 16px;">CovidChart</a>
<a href="covid19save.php" class="l1 mx-2" style="font-size: 16px;">CovidGlobalInfo</a>
</div>
<!-- Main container -->
<div class="container">
<div>
<h2 class="text-center my-4">Asian Countries</h2>
</div>
<?php
$path = "https://restcountries.com/v3.1/region/asia";
$data = json_decode(file_get_contents($path), true);
?>
<!-- Table for displaying country details -->
<table class="table table-striped">
<thead>
<tr>
<th class="text-primary">Flag</th>
<th class="text-primary">Country Name</th>
<th class="text-primary">Capital City</th>
<th class="text-primary">Region</th>
<th class="text-primary">Subregion</th>
<th class="text-primary">Currencies</th>
<th class="text-primary">Country Code</th>
<th class="text-primary">Actions</th>
</tr>
</thead>
<tbody>
<?php foreach ($data as $value): ?>
<?php if ($value['region'] === 'Asia'): ?>
<tr>
<td><img src="<?php echo htmlspecialchars($value['flags']['png']); ?>" width="50px" alt="Flag of <?php echo htmlspecialchars($value['name']['common']); ?>"></td>
<td><?php echo htmlspecialchars($value['name']['common']); ?></td>
<td>
<?php echo !empty($value['capital'][0]) ? htmlspecialchars($value['capital'][0]) : 'NULL'; ?>
</td>
<td><?php echo htmlspecialchars($value['region']); ?></td>
<td><?php echo htmlspecialchars($value['subregion']); ?></td>
<td>
<?php
foreach ($value['currencies'] as $currency) {
echo htmlspecialchars($currency['name']) . " (" . htmlspecialchars($currency['symbol']) . ")<br>";
}
?>
</td>
<td><?php echo htmlspecialchars($value['cca2']); ?></td>
<td><a class="btn btn-success" href="countrydetails.php?cid=<?php echo htmlspecialchars($value['cca2']); ?>">View</a></td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</tbody>
</table>
</div>
<!-- Footer -->
<div class="text-center text-dark py-3" style="font-size: 11px;">All Rights Reserved © 2023</div>
</body>
</html>