added table display on list products

This commit is contained in:
Louis Vallat 2019-11-11 14:53:30 +01:00
parent 5104f917c2
commit 6459b30960

View File

@ -8,21 +8,66 @@ if (!is_connected()) {
$product_list = ""; $product_list = "";
foreach (get_users_products_array() as $row) { foreach (get_users_products_array() as $row) {
$product_list = $product_list . "<p>" $product_list = $product_list . "<tr><td>"
. htmlspecialchars($row["name"]) . "</p>\n"; . htmlspecialchars($row["name"])
. "</td><td>"
. htmlspecialchars($row["description"])
. "</td><td>"
. htmlspecialchars($row["added_date"])
. "</td><td>"
. htmlspecialchars($row["expiration_date"] !== NULL ? $row["expiration_date"] : "-")
. "</td><td>"
. htmlspecialchars($row["cupboard_name"] !== NULL ? $row["cupboard_name"] : "-")
. "</td><tr>\n";
} }
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge"> <meta http-equiv="X-UA-Compatible" content="ie=edge">
<style type="text/css">
table,
th,
td {
border: 1px solid #333;
}
td {
text-align: center;
}
</style>
<title>List products</title> <title>List products</title>
</head> </head>
<body> <body>
<table>
<thead>
<tr>
<th>
Nom
</th>
<th>
Description
</th>
<th>
Ajouté le
</th>
<th>
Expiration
</th>
<th>
Rangement associé
</th>
</tr>
</thead>
<tbody>
<?php echo $product_list; ?> <?php echo $product_list; ?>
</tbody>
</table>
</body> </body>
</html> </html>