G1.php
<?php
$vn = $_POST['vn'];
$tv = $_POST['tv'];
$an = $_POST['an'];
$adres = $_POST['adres'];
$postcode = $_POST['postcode'];
$plaats = $_POST['plaats'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
span{
width:100px;
style:inline-block;
text-align:left;
padding :5px;
}
</style>
</head>
<body>
<?php
function form1(){
echo "<form action='' method='post'>";
echo "\n<div>";
echo "<span>Voornaam</span>";
echo "<input type='text' name='vn' placeholder='Voornaam'";
echo "</div>";
echo "\n<div>";
echo "<span>Tussenvoegsel</span>";
echo "<input type='text' name='tv' placeholder='Tussenvoegsel'";
echo "</div>";
echo "\n<div>";
echo "<span>Achternaam</span>";
echo "<input type='text' name='an' placeholder='Achternaam'";
echo "</div>";
echo "<div><input type='submit' value='Verzenden'></div>";
echo "</form>";
}
function form2(){
global $vn, $tv, $an;
echo "<form action='' method='post'>";
echo "\n<div>";
echo "<span>Adres</span>";
echo "<input type='text' name='adres' placeholder='Adres'";
echo "</div>";
echo "\n<div>";
echo "<span>Postcode</span>";
echo "<input type='text' name='postcode' placeholder='Postcode'";
echo "</div>";
echo "\n<div>";
echo "<span>Woonplaats</span>";
echo "<input type='text' name='plaats' placeholder='Woonplaats'";
echo "</div>";
echo "\n<input type='hidden' name ='vn' value='$vn'>";
echo "\n<input type='hidden' name ='tv' value='$tv'>";
echo "\n<input type='hidden' name ='an' value='$an'>";
echo "\n<div><input type='submit' value='Verzenden'></div>";
echo "</form>";
}
if ($adres!=''){
echo "<div>Welkom $vn $tv $an</div>";
echo "<div>Uw volledige adres is: $adres $postcode $plaats</div>";
}
elseif($vn!=''){
echo "<div>Welkom $vn $tv $an</div>";
form2();
}
else{
form1();
echo $vn;
}
?>
</body>
</html>
Resultaat
Made by Thijs Aarnoudse