parent
7d631219c3
commit
2a67523a56
@ -0,0 +1,4 @@
|
||||
body{
|
||||
margin-top: 10vh;
|
||||
font-family: 'Syncopate', sans-serif;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
body{
|
||||
margin-top: 10vh;
|
||||
font-family: 'Syncopate', sans-serif;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
h1{
|
||||
color: white;
|
||||
}
|
||||
|
||||
#div_form{
|
||||
background-color: grey;
|
||||
width: 500px;
|
||||
padding: 40px;
|
||||
border-radius: 10vh;
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
body{
|
||||
background-color: white;
|
||||
margin-top: 10vh;
|
||||
font-family: 'Syncopate', sans-serif;
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Formulaire</title>
|
||||
<link rel="stylesheet" href="../css/menu.css">
|
||||
<link rel="stylesheet" href="../css/style_formulaire.css">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Syncopate:wght@400;700&display=swap" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header>
|
||||
<nav id="menu">
|
||||
<a href="main" class="liens_dans_le_menu">Page principale</a>
|
||||
<a href="Automobile" class="liens_dans_le_menu">Automobile</a>
|
||||
<a href="Ski" class="liens_dans_le_menu">Ski</a>
|
||||
<a href="Avion" class="liens_dans_le_menu">Aviation</a>
|
||||
<a href="Formulaire" class="liens_dans_le_menu">Formulaire</a>
|
||||
<a href="Perso" class="liens_dans_le_menu">Vie privée</a>
|
||||
<a href="Etudes" class="liens_dans_le_menu">Vie étudiante</a>
|
||||
</nav>
|
||||
<div id="reseaux_fixe">
|
||||
<a href="http://instagram.com" class="liens_réseaux_sociaux_dans_menu"><img src="../images/insta.png" class="logos_réseaux_sociaux_dans_menu" ></a>
|
||||
<a href="http://x.com" class="liens_réseaux_sociaux_dans_menu"><img src="../images/x.png" class="logos_réseaux_sociaux_dans_menu"></a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<h1>Formulaire</h1>
|
||||
|
||||
<div id="div_form">
|
||||
<form action="" method="POST">
|
||||
<label for="nom">Nom :</label>
|
||||
<input type="text" id="nom" name="nom"><br><br>
|
||||
|
||||
<label for="prenom">Prénom :</label>
|
||||
<input type="text" id="prenom" name="prenom"><br><br>
|
||||
|
||||
<label>Sexe :</label>
|
||||
<input type="radio" id="homme" name="sexe" value="Homme">
|
||||
<label for="homme">Homme</label>
|
||||
<input type="radio" id="femme" name="sexe" value="Femme">
|
||||
<label for="femme">Femme</label><br><br>
|
||||
|
||||
<label for="email">Email :</label>
|
||||
<input type="email" id="email" name="email"><br><br>
|
||||
|
||||
<label for="telephone">Numéro de téléphone :</label>
|
||||
<input type="tel" id="telephone" name="telephone" pattern="[0-9]{10}">
|
||||
<small>(Format: 0123456789)</small><br><br>
|
||||
|
||||
<input type="submit" value="Envoyer">
|
||||
</form>
|
||||
</div>
|
||||
<footer>
|
||||
<?php
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
|
||||
$nom = htmlspecialchars(trim($_POST['nom']));
|
||||
$prenom = htmlspecialchars(trim($_POST['prenom']));
|
||||
$sexe = isset($_POST['sexe']) ? htmlspecialchars($_POST['sexe']) : '';
|
||||
$email = filter_var(trim($_POST['email']), FILTER_VALIDATE_EMAIL);
|
||||
$telephone = htmlspecialchars(trim($_POST['telephone']));
|
||||
|
||||
|
||||
if (empty($nom) || empty($prenom) || empty($sexe) || !$email || empty($telephone)) {
|
||||
echo "<p style='color: red;'>Tous les champs sont requis et doivent être valides.</p>";
|
||||
} else {
|
||||
|
||||
if (!preg_match("/^[0-9]{10}$/", $telephone)) {
|
||||
echo "<p style='color: red;'>Le numéro de téléphone doit contenir 10 chiffres.</p>";
|
||||
} else {
|
||||
|
||||
echo "<h2>Données reçues :</h2>";
|
||||
echo "Nom : " . $nom . "<br>";
|
||||
echo "Prénom : " . $prenom . "<br>";
|
||||
echo "Sexe : " . $sexe . "<br>";
|
||||
echo "Email : " . $email . "<br>";
|
||||
echo "Téléphone : " . $telephone . "<br>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Affichage du formulaire si la méthode n'est pas POST
|
||||
?>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in new issue