Guest User

Untitled

a guest
Mar 29th, 2019
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4. <?php
  5. //include "footer.php";
  6. //include "header.php";
  7.  
  8. function test_input($data)
  9. {
  10. $data = trim($data);
  11. $data = stripslashes($data);
  12. $data = htmlspecialchars($data);
  13. return $data;
  14. }
  15. $firstName = $lastName = $telephonenumber = $email = $birthdate = $where = "";
  16.  
  17. if ($_SERVER["REQUEST_METHOD"] == "POST")
  18. {
  19. $firstName = test_input($_POST["firstName"]);
  20. $lastName = test_input($_POST["lastName"]);
  21. $telephonenumber = test_input($_POST["telephonenumber"]);
  22. $email = test_input($_POST["email"]);
  23. $birthdate = test_input($_POST["birthdate"]);
  24. $radio = test_input($_POST["where"]);
  25. $when = test_input($_POST["when"]);
  26. }
  27. ?>
  28. <style>
  29. .split{
  30. width: 50%;
  31.  
  32. top: -10px;
  33. padding-top: 10px;
  34.  
  35. }
  36. .left {
  37. left: 10px;
  38.  
  39.  
  40. }
  41. .right {
  42. right: -60px;
  43. position: fixed;
  44. }
  45.  
  46. </style>
  47.  
  48. <div class="split left">
  49. <form method="post" action="input.php">
  50. <fieldset>
  51. <legend> <b>Personal Information</b> </legend>
  52. <p>
  53.  
  54. <label>First Name </label><br>
  55. <input type="text" name="firstName" />
  56. </p>
  57. <p>
  58.  
  59. <label>Last Name </label><br>
  60. <input type="text" name="lastName" />
  61. </p>
  62.  
  63. <label>Telephone Number </label><br>
  64. <input type="number" name="telephonenumber" />
  65. </p>
  66.  
  67. <label>Email </label><br>
  68. <input type="email" name="email" />
  69. </p>
  70.  
  71. <label>Birth Date </label><br>
  72. <input type="date" name="birthdate" />
  73. </p>
  74. </fieldset>
  75.  
  76. <br>
  77. <form method="get" action="input.php">
  78. <fieldset>
  79. <legend> <b>Profession</b> </legend>
  80. <input type="radio" name="where" value="Student" >Student <br/>
  81. <input type="radio" name="where" value="Doctor">Doctor <br/>
  82. <input type="radio" name="where" value="Farmer">Farmer <br/>
  83. <input type="radio" name="where" value="Engineer">Engineer <br/>
  84. </fieldset>
  85. <br>
  86.  
  87. <form method="get" action="input.php">
  88. <fieldset>
  89.  
  90. <legend> <b>Favorite Sports</b></legend>
  91. <select name="when" size ="4">
  92. <option value="Hockey"> Hockey </option>
  93. <option value="Football"> Football </option>
  94. <option value="Curling"> Curling </option>
  95. <option value="Tennis"> Tennis </option>
  96. </select>
  97. </p>
  98. </fieldset>
  99. <br>
  100.  
  101. <input type="submit"/>
  102. <input type="reset"/>
  103. </div>
  104.  
  105. <div class="split right">
  106. <?php
  107. echo "<br><br><br><br>";
  108. echo 'First name: ', $firstName;
  109. echo "<br>";
  110. echo 'Last name: ', $lastName;
  111. echo "<br>";
  112. echo 'Telephone number: ', $telephonenumber;
  113. echo "<br>";
  114. echo 'Email: ', $email;
  115. echo "<br>";
  116. echo 'Birth Date: ', $birthdate;
  117. echo "<br>";
  118. echo 'Profession: ', $radio;
  119. echo "<br>";
  120. echo 'Favorite sport: ', $when;
  121.  
  122.  
  123. ?>
  124. </div>
  125.  
  126.  
  127.  
  128. </body>
  129. </html>
Add Comment
Please, Sign In to add comment