update
This commit is contained in:
63
DEV.2.2/TP/TP1/ex3/index.php
Normal file
63
DEV.2.2/TP/TP1/ex3/index.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
include './include/data.inc.php';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>tp1 - ex3</title>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.classless.min.css"
|
||||
>
|
||||
<link rel="stylesheet" href="./css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<h2>Exercice 3 : IMC </h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nom</th>
|
||||
<th>Prénom</th>
|
||||
<th>Email</th>
|
||||
<th>Taille</th>
|
||||
<th>Poids</th>
|
||||
<th>IMC</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach($data as $person){
|
||||
echo"<table>";
|
||||
echo"<tr>";
|
||||
echo"<th>";
|
||||
$imc = round($person['Poids']/($person['Taille'] * $person[$taille])*10000,2);
|
||||
foreach($person as $value) {
|
||||
echo "<td>$value</td>";
|
||||
echo "<td>$imc</td>";
|
||||
|
||||
}
|
||||
|
||||
$warning = "";
|
||||
if ($imc >= 25) {
|
||||
$warning = 'warning';
|
||||
echo "<tr class='$warning'>";
|
||||
echo "</tr>";
|
||||
}
|
||||
foreach($person as $value)
|
||||
echo "<td>$value</td>"
|
||||
echo "<td>$imc</td></tr>";
|
||||
|
||||
echo"</th>";
|
||||
echo"</tr>";
|
||||
echo"</table>";
|
||||
}
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user