BasesWeb/BACKEND/PHP/tp4/ex1/index.php

59 lines
1.4 KiB
PHP
Raw Normal View History

2023-05-16 11:27:42 +02:00
<?php
$OS = "linux";
if(!isset($_POST['OS'])){
if (!isset($_COOKIE['OS'])){
setcookie('OS', $OS, time()+60);
} else {
$OS = $_COOKIE['OS'];
}
} else {
$OS=$_POST['OS'];
setcookie('OS', $OS, time()+60);
}
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://unpkg.com/@picocss/pico@1.*/css/pico.min.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<main class="container">
<section>
<section>
<form method="POST">
<fieldset>
<legend>Changez votre OS</legend>
<label>
<input type="radio" name="OS" value="linux">
<i class="fa fa-linux fa-2x" aria-hidden="true"></i>
</label>
<label>
<input type="radio" name="OS" value="windows">
<i class="fa fa-windows fa-2x" aria-hidden="true"></i>
</label>
<label>
<input type="radio" name="OS" value="apple">
<i class="fa fa-apple fa-2x" aria-hidden="true"></i>
</label>
</fieldset>
<button type="submit">Envoyer</button>
</form>
</section>
<section>
<p>
<?php echo "<i class='fa fa-$OS fa-4x'></i>";?>
</p>
<p>Rafraîchir la page <a href=""><i class="fa fa-refresh" aria-hidden="true"></i></a></p>
</section>
</section>
</main>
</body>
</html>