2026-03-23 14:01:45 +01:00
|
|
|
<?php
|
2026-04-15 15:34:46 +02:00
|
|
|
include_once './include/data.inc.php';
|
2026-03-23 14:01:45 +01:00
|
|
|
?>
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="fr">
|
2026-04-15 15:34:46 +02:00
|
|
|
<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 include_once './include/data.inc.php'; ?>
|
|
|
|
|
<?php foreach ($data as $person) : ?>
|
|
|
|
|
<?php
|
|
|
|
|
$poids = (float) $person['Poids'];
|
|
|
|
|
$tailleM = (float) $person['Taille'] / 100;
|
2026-03-23 14:01:45 +01:00
|
|
|
|
2026-04-15 15:34:46 +02:00
|
|
|
$imc = null;
|
|
|
|
|
if ($tailleM > 0) {
|
|
|
|
|
$imc = $poids / ($tailleM * $tailleM);
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
<tr class="<?= $imc < 18.5 ? 'underweight' : ($imc < 25 ? 'normal' : 'warning') ?>">
|
|
|
|
|
<td><?= $person['Nom'] ?></td>
|
|
|
|
|
<td><?= $person['Prenom'] ?></td>
|
|
|
|
|
<td><?= $person['Email'] ?></td>
|
|
|
|
|
<td><?= $person['Taille'] ?></td>
|
|
|
|
|
<td><?= $person['Poids'] ?></td>
|
|
|
|
|
<td><?= round($imc, 2) ?></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</main>
|
|
|
|
|
</body>
|
2026-03-23 14:01:45 +01:00
|
|
|
</html>
|