-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSelectionPays.php
More file actions
147 lines (111 loc) · 5.68 KB
/
Copy pathSelectionPays.php
File metadata and controls
147 lines (111 loc) · 5.68 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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php // Ce formulaire, cest pour se connecter pour ceux qui ont un compte?>
<?php Include "Entete.php";?>
<div class="container">
<h2 class="h3">SELECTION PAYS 2</h2>
<form action="SelectionPays.php" method="post">
<div class="row">
<div class="col-4">
<select name ="selection" class="form-select" aria-label="Default select example">
<option selected>Selectionner un pays</option>
<?php
// The connexion root variable is created.
$connection = mysqli_connect("localhost","root","","php_project");
// If The connexion is established or not.
if (!$connection)
{
echo"<h3 class='h5'> Sorry, Database is currently inaccessible .</h3>";
}
else
{
$result0 = mysqli_query($connection, "SELECT nomPays FROM pays;");
# Die if connection net established
if(!$result0)
{
die(mysqli_error($connection));
}
else
{
if(!$result0){
die(mysqli_error($connection));
}
if (mysqli_num_rows($result0) > 0)
{
while($rowData = mysqli_fetch_assoc($result0))
{
echo'<option value="'.$rowData["nomPays"].'">'.$rowData["nomPays"]."</option>";
}
}
}
}
?>
</select>
</div>
<div class="col-2">
<button type="submit" class="btn btn-secondary" name ="submit">Afficher</button>
</div>
<div class="col-6">
</div>
</div>
</form>
<hr>
<hr>
<hr>
<div class="row">
<div class="col-4 d-none d-sm-block">
</div>
<div class="col-8">
<table class="table table-striped table-hover table-responsive ">
<tr>
<th>Nom Pays</th>
<th>Capitales</th>
<th>Continents</th>
<th>Drapeau</th>
</tr>
<?php
if(isset($_POST['submit']))
{
$selection = $_POST['selection'];
echo"Vous avez selectionné   <span class='h2'>$selection</span>";
// The connexion root variable is created.
$connection = mysqli_connect("localhost","root","","php_project");
// If The connexion is established or not.
if (!$connection)
{
echo"<h3 class='h5'> Sorry, Database is currently inaccessible .</h3>";
}
else
{
// Requete descente des inscrits pour Verification des credentials
$result = mysqli_query($connection, "SELECT * FROM pays WHERE nomPays='$selection';");
# Die if connection net established
if(!$result)
{
die(mysqli_error($connection));
}
else
{
if(!$result)
{
die(mysqli_error($connection));
}
if (mysqli_num_rows($result) > 0)
{
while($rowData = mysqli_fetch_assoc($result))
{
echo"<tr>";
echo"<td>". $rowData["nomPays"];echo"</td>";
echo"<td>". $rowData["capitalPays"];echo"</td>";
echo"<td>". $rowData["continentPays"];echo"</td>";
echo "<td>";echo'<img src="'.$rowData['urlDrapeau'].'" alt="" width="45" height="30">';echo"</td>";
echo"</tr>";
}
}
}
}
}
?>
</table>
</div>
</div>
<?php Include "Pied.php";?>
</div>