-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathregene.php
41 lines (40 loc) · 1.02 KB
/
regene.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
function afficheForm(){
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<center>
<form action="" method="post">
<input type="text" name="prenom" placeholder="prenom" value="<?php echo $_POST['prenom']; ?>"></br>
<input type="number" name="age" placeholder="age" value="<?php echo $_POST['age']; ?>"></br>
<input type="submit" value='submit' name="submit" />
</form>
</center>
</body>
</html>
<?php
};
if(isset($_POST['submit']))
{
if(!empty($_POST['prenom'])&& !empty($_POST['age']))
echo "BONJOUR! votre age est :".$_POST['age'] ;
else
{
if(empty($_POST['prenom']) )
echo "veuilliez renseigner votre prenom <br>";
if(empty($_POST['age']) )
echo "veuillez renseigner votre age";
afficheForm();
}
}else
{
$_POST['prenom']="";
$_POST['age']="";
afficheForm();
}
?>