form - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of form.php

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.   <title>Inschrijfformulier Bit Academy</title>
  5.   <link rel="stylesheet" href="style.css">
  6.   <style>
  7.   #Aanmeldpagina nieuwsbrief {
  8.     font-family: 'Courier New', Courier, monospace;
  9.   }
  10. </style>
  11. </head> 
  12. <body>
  13.   <form action="http://localhost:8000/sign_up.html?naam=Lissy" method="GET">
  14.     <h1>Aanmeldpagina nieuwsbrief</h1>
  15.     
  16.     <div>
  17.     <label for="fname">Naam</label><br>
  18.     <input type="text" id="fname" name="fname"><br>
  19.     </div>
  20.  
  21.     <div>
  22.     <label for="email">Email</label><br>
  23.     <input type="email" id="email" name="email"><br>
  24.     </div>
  25.     
  26. Email = $email = "[email protected]";
  27.  
  28. // Remove all illegal characters from email
  29. $email = filter_var($email, FILTER_SANITIZE_EMAIL);
  30.  
  31. // Validate e-mail
  32. if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
  33.     echo("$email is a valid email address");
  34. } else {
  35.     echo("$email is not a valid email address");
  36. }
  37.  
  38.     <div>
  39.     <label for="phone">Telefoonnummer</label><br>
  40.     <input type="tel" id="phone" name="phone"><br>
  41.     </div>
  42.  
  43.     <div>
  44.     <label for="pass">Secret</label><br>
  45.     <input type="password" id="pass" name="password"><br>
  46.     </div>
  47.  
  48. <p>Favoriete dagen in de week:</p>
  49.  
  50. <div>
  51.   <input type="checkbox" id="maandag" name="maandag"
  52.          checked>
  53.   <label for="maandag">Maandag</label>
  54. </div>
  55.  
  56. <div>
  57.   <input type="checkbox" id="dinsdag" name="dinsdag">
  58.   <label for="dinsdag">Dinsdag</label>
  59. </div>
  60.  
  61. <div>
  62.   <input type="checkbox" id="woensdag" name="woensdag">
  63.   <label for="woensdag">Woensdag</label>
  64. </div>
  65.  
  66. <div>
  67.   <input type="checkbox" id="donderdag" name="donderdag">
  68.   <label for="donderdag">Donderdag</label>
  69. </div>
  70.  
  71. <div>
  72.   <input type="checkbox" id="vrijdag" name="vrijdag">
  73.   <label for="vrijdag">Vrijdag</label>
  74. </div>
  75.  
  76. <div>
  77.   <input type="checkbox" id="zaterdag" name="zaterdag">
  78.   <label for="zaterdag">Zaterdag</label>
  79. </div>
  80.  
  81. <div>
  82.   <input type="checkbox" id="zondag" name="zondag">
  83.   <label for="zondag">Zondag</label>
  84. </div>
  85.  
  86. <div>
  87. <label for="opmerkingen">Opmerkingen:</label>
  88. </div>
  89.  
  90. <div>
  91. <textarea id="opmerkingen" name="opmerkingen" rows="6" cols="50">
  92. </textarea>
  93. </div>
  94.  
  95. <div>
  96.     <input type="submit" value="Submit Query"><br>
  97.      <form action="/action_page.php" method="post"> 
  98.      header('Location: success.php')
  99. </div>
  100.  
File Description
  • form
  • PHP Code
  • 19 Oct-2021
  • 2.22 Kb
You can Share it: