64 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			64 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?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>
 |