Hello, I am a begginer and I want to use a form in my website, I want the form and answer (php) to appear on the same page, but there is some error :
Notice: Undefined index: nom in C:\Users\user\Desktop\PROJET\la ragon\www\inscription.php on line 60
Notice: Undefined index: prenom in C:\Users\user\Desktop\PROJET\la ragon\www\inscription.php on line 61
Notice: Undefined index: age in C:\Users\user\Desktop\PROJET\la ragon\www\inscription.php on line 62
Notice: Undefined index: date in C:\Users\user\Desktop\PROJET\la ragon\www\inscription.php on line 63
I don’t know what I have to change, here is a part of the php file (with the form and php code), some text are in french…
How to add php tag ? the code is not displayed correctly…
<php>
<form action="" method="post">
<label>Nom</label> :
<input type="text" required="required" pattern="[a-zA-Z]{1,}" name="nom" />
<label>Prénom</label> :
<input type="text" required="required" pattern="[a-zA-Z]{1,}" name="prenom" />
<input type="date" required="required" name="date" />
<label>Age</label> :
<input type="number" required="required" name="age" />
<input type="submit" value="Envoyer" />
<?php
date_default_timezone_set('Europe/Madrid');
$n=$_POST['nom'];
$p=$_POST['prenom'];
$q=$_POST['age'];
$r=$_POST['date'];
$sup=40;
setlocale(LC_TIME, 'french');
if ($q > $sup) {
echo "Bonjour ".$p." ".$n.",vous etes inscrit pour le ".strftime('%A %d %B %Y', strtotime($r))." et vous avez ".$q." ans donc vous ne payez rien .";
} elseif ($q == $sup){
echo "Bonjour ".$p." ".$n.",vous etes inscrit pour le ".strftime('%A %d %B %Y', strtotime($r))." et vous avez ".$q." ans donc vous ne payer rien.";
}
else{
echo "Bonjour ".$p." ".$n.",vous etes inscrit pour le ".strftime('%A %d %B %Y', strtotime($r))." et vous avez ".$q." ans donc vous payez 10 euros.";
}
?>
</form>
</php>