DEV/DEV2.3/WEBBE/TP2/exo1.php

50 lines
1.4 KiB
PHP
Raw Permalink Normal View History

2023-04-26 11:00:04 +02:00
<!DOCTYPE html>
<html>
<body>
<form action="/action_page.php" method="POST">
<h2>Qui etes-vous ?</h2>
<label for="surname">nom:</label><br>
<input type="text" id="surname" name="surname" value=""><br>
<label for="name">prenom:</label><br>
<input type="text" id="name" name="name" value="">
<br>
<h2>Sexe :</h2>
<input type="radio" name="sexe" id="Homme" value="Homme">
<label for="Homme">Homme</label><br>
<input type="radio" name="sexe" id="Femme" value="Femme">
<label for="Femme">Femme</label><br>
<input type="radio" name="sexe" id="nb" value="nb">
<label for="nb">Non-Binaire</label><br>
<input type="radio" name="sexe" id="other" value="other">
<label for="other">other</label><br>
<input type="submit" value="Submit">
</form>
<br>
<h2>
<?php
if(isset($_POST["surname"])&& isset($_POST["name"])&& isset($_POST["sexe"]))
{
$surname = $_POST["surname"];
$name = $_POST["name"];
$sexe = $_POST["sexe"];
if($sexe=="Homme")
{
echo "Bonjour Monsieur $surname $name";
}else{
if($sexe=="Femme")
{
echo "Bonjour Monsieur $surname $name";
}else{
if($sexe=="nb")
{
echo "Bonjour $surname $name";
}else{
if($sexe=="other")
{
echo "Bonjour Monsieur/Madame $surname $name";
}}}}
}
?>
</h2>
</body>
</html>