16 Mai
This commit is contained in:
12
BACKEND/PHP/tp4/ex1/css/style.css
Normal file
12
BACKEND/PHP/tp4/ex1/css/style.css
Normal file
@@ -0,0 +1,12 @@
|
||||
main>section {
|
||||
display: flex;
|
||||
align-items:center;
|
||||
justify-content:space-between;
|
||||
}
|
||||
|
||||
section > section {
|
||||
width: 25%;
|
||||
}
|
||||
section > section + section {
|
||||
width: 50%;
|
||||
}
|
58
BACKEND/PHP/tp4/ex1/index.php
Normal file
58
BACKEND/PHP/tp4/ex1/index.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?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>
|
||||
|
Reference in New Issue
Block a user