Advertisement
HenriqueZ

Form-check-namen

Oct 10th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>hallo</title>
  6. </head>
  7. <body>
  8. <?php
  9. $voornaam = "";
  10. $achternaam = "";
  11. $voornaamFout = "";
  12. $invoerOK = false;
  13.  
  14. if (!empty($_GET["verzendKnop"]) && $_GET["verzendKnop"] == "Verzenden") {
  15. if (empty($_GET["voornaam"]) || empty($_GET["achternaam"])) {
  16. print "Je hebt niet alle velden ingevuld ingevuld";
  17. } else {
  18. // alles ok
  19. $invoerOK = true;
  20. }
  21. if (!empty($_GET["voornaam"])) {
  22. $voornaam = $_GET["voornaam"];
  23. }
  24. if (!empty($_GET["achternaam"])) {
  25. $achternaam = $_GET["achternaam"];
  26. }
  27. }
  28. ?>
  29.  
  30. <?php if ($invoerOK) { ?>
  31. <h4>bedankt</h4>
  32. <?php } else { ?>
  33. <form method="get" action="hallo.php">
  34. Voornaam: <input type="text" name="voornaam" value="<?php print $voornaam; ?>"><br />
  35. Achternaam: <input type="text" name="achternaam" value="<?php print $achternaam; ?>">
  36. <input type="submit" name="verzendKnop" value="Verzenden">
  37. </form>
  38. <?php } ?>
  39. </body>
  40. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement