Files
web_2025/R3.01/tp/tp4/ex1/views/main.php
T

51 lines
2.0 KiB
PHP
Raw Normal View History

2026-04-12 17:58:57 +02:00
<!doctype html>
2026-04-15 16:03:11 +02:00
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Cookie OS préféré</title>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css"
/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<main class="container">
<form method="POST">
<fieldset class="grid">
<legend>Changez votre os</legend>
<?php foreach ($osSet as $value => $label) { ?>
<label>
<input
type="radio"
name="os"
value="<?php echo htmlspecialchars($value, ENT_QUOTES); ?>"
<?php echo $os === $value ? 'checked' : ''; ?>
>
<i class="fa fa-<?php echo htmlspecialchars($value, ENT_QUOTES); ?> fa-2x" aria-hidden="true"></i>
<?php echo htmlspecialchars($label, ENT_QUOTES); ?>
</label>
<?php } ?>
</fieldset>
2026-04-12 17:58:57 +02:00
2026-04-15 16:03:11 +02:00
<button type="submit">Envoyer</button>
</form>
<article>
<header>Votre os</header>
<p>
<!-- On affiche l'icône et le nom de l'OS courant. -->
<i class="fa fa-<?php echo htmlspecialchars($os, ENT_QUOTES); ?> fa-5x" aria-hidden="true"></i>
</p>
<p><?php echo htmlspecialchars($osSet[$os], ENT_QUOTES); ?></p>
<footer>
Rafraîchir la page
<a href="./" aria-label="Rafraîchir la page">
<i class="fa fa-refresh" aria-hidden="true"></i>
</a>
</footer>
</article>
</main>
</body>
2026-04-12 17:58:57 +02:00
</html>