1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
| <!-- horloge.php : -->
<html>
<head>
<title>Page configuration réveil</title>
<style>
body{
background-color: #f1f1f1;
}
.wrapper{
border-radius: 10px;
position: absolute;
top: 50%; left: 50%;
transform: translate(-50%, -50%);
border:2em solid white;
background-color: white;
box-shadow: 0 1px 3px rgba(0,0,0,.13);
text-align: center;
}
select{
background-color: white;
border: 0.001em solid black;
color: black;
padding: 8px 16px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
}
input[type="submit"]{
display: block;
padding-left: auto;
padding-right: auto;
background-color: #FF7006;
border: none; color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px
}
</style>
</head>
<body>
<div class="wrapper">
<h1 style="font-family: Arial,sans-serif">HEURE DE RÉVEIL </h1>
<?php
/* Tu déclare tes données de bases. */
$data = [
'dhour' => '',
'hour' => '',
'dminute' => '',
'minute' => ''
];
/* si le fichiers de données existe. */
if(file_exists('heure.json')) {
/* Tu récupére les donnes. */
$file = file_get_contents('heure.json');
$data = json_decode($file, true);
}
?>
<form action="traitement.php" method="post">
<div class="form-group">
<select name="dhour" id="dhour" required>
<!-- Tu parcours une liste et si la valeur dans le fichier correspond à l'élément de la liste tu le selectionne. -->
<?php for($i = 0; $i <= 2; $i++): ?>
<option value="<?php echo $i; ?>" <?php if($data['dhour'] == $i): ?> selected <?php endif; ?>><?php echo $i; ?></option>
<?php endfor; ?>
</select>
<select name="hour" id="hour" required>
<?php for($i = 0; $i <= 9; $i++): ?>
<option value="<?php echo $i; ?>" <?php if($data['hour'] == $i): ?> selected <?php endif; ?>><?php echo $i; ?></option>
<?php endfor; ?>
</select>
<span>:</span>
<select name="dminute" id="dminute" required>
<?php for($i = 0; $i <= 5; $i++): ?>
<option value="<?php echo $i; ?>" <?php if($data['dminute'] == $i): ?> selected <?php endif; ?>><?php echo $i; ?></option>
<?php endfor; ?>
</select>
<select name="minute" id="minute" select="<?php echo $data['minute']; ?>" required>
<?php for($i = 0; $i <= 9; $i++): ?>
<option value="<?php echo $i; ?>" <?php if($data['minute'] == $i): ?> selected <?php endif; ?>><?php echo $i; ?></option>
<?php endfor; ?>
</select>
</div>
<div class="form-group">
<input name="submit" type="submit" style ="" value="Programmer" />
</div>
</form>
</div>
</body>
</html> |
Partager