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">
|
2024-12-01 19:20:28 +01:00
|
|
|
<label for="title"><span style="color: #e03e2d;"><strong>*</strong></span> Veuillez vous présenter :</label><br>
|
2024-11-24 11:30:36 +01:00
|
|
|
<input type="text" id="title" name="title" required><br>
|
2024-12-01 19:20:28 +01:00
|
|
|
<label>
|
|
|
|
<input type="checkbox" id="notPresent" name="not_present">
|
|
|
|
Je ne serai pas présent
|
|
|
|
</label>
|
|
|
|
|
|
|
|
<h3>ou</h3>
|
2024-11-24 11:30:36 +01:00
|
|
|
|
|
|
|
<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">
|
2024-12-01 19:20:28 +01:00
|
|
|
<label for="rdv">Rendez-vous au point de départ</label><br><br>
|
2024-11-24 11:30:36 +01:00
|
|
|
</div>
|
|
|
|
|
2024-12-01 19:20:28 +01:00
|
|
|
<label for="description">Vous pouvez ajouter un commentaire :</label><br>
|
2024-11-24 11:30:36 +01:00
|
|
|
<textarea id="description" name="description"></textarea><br>
|
|
|
|
<!-- CAPTCHA -->
|
2024-12-01 19:20:28 +01:00
|
|
|
<label for="captcha"><span style="color: #e03e2d;"><strong>*</strong></span><strong> Résolvez cette opération :</strong></label><br>
|
|
|
|
<span style="font-size: 20px; color:#0039a6;"><?php echo $_SESSION['captcha_num1']; ?> + <?php echo $_SESSION['captcha_num2']; ?> = </span>
|
2024-11-24 11:30:36 +01:00
|
|
|
<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>
|
2024-12-01 19:20:28 +01:00
|
|
|
<a href="javascript:history.go(-1)"><img src="./images/retour.png" width="100" height="60" border="0" title="Retour page précédente" alt="Retour page précedente"></a>
|
|
|
|
|
2024-11-24 11:30:36 +01:00
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|