92 lines
3.7 KiB
PHP
92 lines
3.7 KiB
PHP
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
<title>Document</title>
|
||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
|
||
|
<div class="container p-5">
|
||
|
<h1> Formulaire </h1>
|
||
|
|
||
|
<form class="pt-3" method="POST" action="#">
|
||
|
<div class="mb-3">
|
||
|
<label for="nom" class="form-label">Nom :</label>
|
||
|
<input type="text" class="form-control" id="nom" name="nom">
|
||
|
</div>
|
||
|
|
||
|
<div class="mb-3">
|
||
|
<label for="email" class="form-label">Email :</label>
|
||
|
<input type="text" class="form-control" id="email" name="email">
|
||
|
</div>
|
||
|
|
||
|
<div class="mb-3">
|
||
|
<label for="message" class="form-label">Message :</label>
|
||
|
<textarea class="form-control" id="message" name="message"></textarea>
|
||
|
</div>
|
||
|
|
||
|
<div class="mb-3">
|
||
|
<label class="form-label">Choix unique :</label><br>
|
||
|
<div class="form-check form-check-inline">
|
||
|
<input class="form-check-input" type="radio" id="choix1" name="choix" value="choix1">
|
||
|
<label class="form-check-label" for="choix1">Choix 1</label>
|
||
|
</div>
|
||
|
<div class="form-check form-check-inline">
|
||
|
<input class="form-check-input" type="radio" id="choix2" name="choix" value="choix2">
|
||
|
<label class="form-check-label" for="choix2">Choix 2</label>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="mb-3">
|
||
|
<label class="form-label">Choix multiples :</label><br>
|
||
|
<div class="form-check">
|
||
|
<input class="form-check-input" type="checkbox" id="option1" name="options[]" value="option1">
|
||
|
<label class="form-check-label" for="option1">Option 1</label>
|
||
|
</div>
|
||
|
<div class="form-check">
|
||
|
<input class="form-check-input" type="checkbox" id="option2" name="options[]" value="option2">
|
||
|
<label class="form-check-label" for="option2">Option 2</label>
|
||
|
</div>
|
||
|
<div class="form-check">
|
||
|
<input class="form-check-input" type="checkbox" id="option3" name="options[]" value="option3">
|
||
|
<label class="form-check-label" for="option3">Option 3</label>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<input name="userIP" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>" type="hidden">
|
||
|
<input name="userDATE" value="<?php echo date("Y-m-d H:i:s"); ?>" type="hidden">
|
||
|
|
||
|
|
||
|
<button type="submit" name="valide" class="btn btn-primary">Envoyer</button>
|
||
|
</form>
|
||
|
|
||
|
|
||
|
<?php
|
||
|
if (isset($_POST['valide'])) {
|
||
|
echo "<h1> Réponse </h1>";
|
||
|
foreach ($_POST as $cle => $valeur) {
|
||
|
if (is_string($valeur)) {
|
||
|
$valeur = strtolower($valeur);
|
||
|
}
|
||
|
if (is_array($valeur)) {
|
||
|
$valeur = implode(", ", $valeur);
|
||
|
}
|
||
|
echo "<strong>$cle</strong> : $valeur <br>";
|
||
|
}
|
||
|
}
|
||
|
?>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>
|
||
|
|
||
|
</body>
|
||
|
|
||
|
</html>
|