Advertisement
cska1312

form

Jan 11th, 2023
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.11 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="utf-8" />
  5.     <title>{ firstProject }</title>
  6. </head>
  7.  
  8.  
  9.  
  10. <body>
  11.     <form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
  12.         Name: <input type="text" name="name"><br>
  13.         E-mail:<input type="text" name="email"><br>
  14.         Password: <input type="password" name="password"><br>
  15.         <input type="submit">
  16.     </form>
  17.  
  18.  
  19.  
  20.    <?php
  21.      if ($_SERVER["REQUEST_METHOD"] == "POST"){
  22.         $name = $_POST['name'];
  23.         if(empty($name)){
  24.             echo "Name is empty";
  25.         }
  26.         else{
  27.             echo "<h3>The name is: $name";
  28.             echo "<br>";
  29.         }
  30.         $email = $_POST['email'];
  31.         if(empty($email)){
  32.             echo "Email is empty";
  33.         }
  34.         else{
  35.             echo "The email is: $email";
  36.             echo "<br>";
  37.         }
  38.         $password = $_POST['password'];
  39.         if(empty($password)){
  40.             echo "Password is empty";
  41.         }
  42.         else{
  43.             echo "The password is: $password</h3>";
  44.         }
  45.      }
  46.     ?>
  47. </body>
  48. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement