2024-11-24 11:30:36 +01:00
|
|
|
<?php
|
|
|
|
// formulaire.php
|
|
|
|
include 'annonces.php'; // Charger les fonctions nécessaires
|
|
|
|
session_start(); // Nécessaire pour utiliser les variables de session
|
|
|
|
|
|
|
|
// Générer deux chiffres aléatoires pour l'addition
|
|
|
|
$_SESSION['captcha_num1'] = rand(1, 10);
|
|
|
|
$_SESSION['captcha_num2'] = rand(1, 10);
|
|
|
|
?>
|
|
|
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="fr">
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>Formulaire de participation</title>
|
2024-11-24 15:13:13 +01:00
|
|
|
<link rel="stylesheet" type="text/css" href="../quest-rando/style.css">
|
2024-11-24 11:30:36 +01:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<h1>Qui vient... ou pas</h1>
|
|
|
|
|
|
|
|
<form method="POST" action="traitement.php">
|
|
|
|
<label for="title"><span style="color: #e03e2d;"><strong>*</strong></span> Indiquez qui vous êtes :</label><br>
|
|
|
|
<input type="text" id="title" name="title" required><br>
|
|
|
|
|
|
|
|
<label for="nombre">Indiquez le nombre de personnes :</label>
|
|
|
|
<input type="number" id="nombre" name="nombre" min="1"><br><br>
|
|
|
|
|
|
|
|
<div id="additionalOptions" style="display: none;">
|
|
|
|
<label><span style="color: #e03e2d;"><strong>*</strong> Choisissez une option :</label><br>
|
|
|
|
<input type="radio" id="covoiturage" name="transport_option" value="Covoiturage">
|
|
|
|
<label for="covoiturage">Rendez-vous pour du covoiturage</label><br>
|
|
|
|
|
|
|
|
<input type="radio" id="rdv" name="transport_option" value="Rendez-vous départ">
|
|
|
|
<label for="rdv">Rendez-vous au point de départ</label><br>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<label>
|
|
|
|
<input type="checkbox" id="notPresent" name="not_present">
|
|
|
|
Je ne serai pas présent
|
|
|
|
</label><br>
|
|
|
|
|
|
|
|
<label for="description">Si vous avez quelque chose à ajouter :</label><br>
|
|
|
|
<textarea id="description" name="description"></textarea><br>
|
|
|
|
<!-- CAPTCHA -->
|
|
|
|
<label for="captcha"><span style="color: #e03e2d;"><strong>*</strong></span> Résolvez cette opération :</label><br>
|
|
|
|
<span><?php echo $_SESSION['captcha_num1']; ?> + <?php echo $_SESSION['captcha_num2']; ?> = </span>
|
|
|
|
<input type="number" id="captcha" name="captcha" required><br>
|
|
|
|
<?php if (isset($_GET['captcha_error'])): ?>
|
|
|
|
<div style="color: red;">Erreur : La réponse est incorrecte.</div>
|
|
|
|
<?php endif; ?>
|
|
|
|
<p style="text-align: right;"><span style="color: rgb(224, 62, 45);"><strong>*</strong> <em><span style="color: rgb(126, 140, 141);">Obligatoire</span></em></span></p>
|
|
|
|
<button type="submit">Envoyer ma réponse</button>
|
|
|
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
const nombreField = document.getElementById('nombre');
|
|
|
|
const additionalOptions = document.getElementById('additionalOptions');
|
|
|
|
const transportOptions = document.getElementsByName('transport_option');
|
|
|
|
const notPresentCheckbox = document.getElementById('notPresent');
|
|
|
|
|
|
|
|
nombreField.addEventListener('input', function() {
|
|
|
|
if (parseInt(this.value) > 0) {
|
|
|
|
additionalOptions.style.display = 'block';
|
|
|
|
transportOptions.forEach(option => option.required = true);
|
|
|
|
} else {
|
|
|
|
additionalOptions.style.display = 'none';
|
|
|
|
transportOptions.forEach(option => option.required = false);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
notPresentCheckbox.addEventListener('change', function() {
|
|
|
|
if (this.checked) {
|
|
|
|
nombreField.value = '';
|
|
|
|
nombreField.disabled = true;
|
|
|
|
additionalOptions.style.display = 'none';
|
|
|
|
transportOptions.forEach(option => option.checked = false);
|
|
|
|
} else {
|
|
|
|
nombreField.disabled = false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|