I did a form which adds record to database and it shows in HTML table. One of the column in form and database is "country". I would like to insert a right flag icon beside the "country" column and I'd like to make it from form. I added example photo
Could you help me with any idea?
Form
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="style2.css">
</head>
<body>
<?php
if (isset($_GET["date"]) ){
$date = $_GET["date"];
$country = $_GET["country"];
$city = $_GET["city"];
$place = $_GET["place"];
if( empty ( $date ) || empty ($country) || empty ($city) || empty ($place)){
echo "Wypelnij wszystkie pola";
} else {
$conn = new mysqli("localhost", "root", "", "tour");
$odp = $conn->query("INSERT INTO trasy (date, country, city, place)
VALUES ('$date', '$country', '$city', '$place')");
header("Location: index5.php");
if ($odp) {
echo "Dodano koncert";
}else{
echo "Nie udalo sie dodac";
}
$conn->close();
}
}
?>
<div id="login">
<form method="GET" action="index5.php">
<table id="customers">
<input name="date" type="date" placeholder="Date..."><br>
<input name="country" type="text" placeholder="Country..."><br>
<input name="city" type="text" placeholder="City..."><br>
<input name="place" type="text" placeholder="Place..."><br>
<input type="submit" value="OK">
</table>
</form>
</div>
</body>
</html>
HTML table
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="style3.css">
</head>
<body>
<table id="customers">
<tr>
<th>Date</th>
<th>Country</th>
<th>City</th>
<th>Place</th>
<th>Info</th>
</tr>
<?php
$conn = new mysqli("localhost", "root", "", "tour")
or die ("Błąd");
$wynik = $conn->query("SELECT * FROM trasy ORDER BY date DESC");
if ($wynik->num_rows > 0){
while ( $wiersz = $wynik->fetch_assoc() ){
echo "<tr>";
echo "<td>" . $wiersz["date"] . "</td>";
echo "<td>" . $wiersz["country"] . "</td>";
echo "<td>" . $wiersz["city"] . "</td>";
echo "<td>" . $wiersz["place"] . "</td>";
echo "<td>" . $wiersz["info"] . "</td>";
echo "</tr>";
}
echo "</table>";
} else {
echo "Nic tu nie ma";
}
$conn->close();
?>
</table>
</body>
</html>