Advertisement
Guest User

Untitled

a guest
May 31st, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. //First File
  2. <html>
  3. <head>
  4. <title> Form</title>
  5. </head>
  6. <body>
  7. <!-- HTML Login Form -->
  8. <form action="form_processing.php" method="post"> <!-- Form method here is 'post' method -->
  9. Username: <input type="text" name="username" value=""><br/>
  10. password: <input type="password" name="password" value=""><br/>
  11. <br/>
  12. <input type="submit" name="submit" value="Submit"> <!-- When user submits, the form data is posted to form_processing.php -->
  13. </form>
  14.  
  15. </body>
  16. </html>
  17.  
  18.  
  19.  
  20. //Second File
  21. <?php
  22. $username = $_POST['username']; //Gets the username through the superglobal POST array from index.php
  23. $password = $_POST['password']; //Gets the password through the superglobal POST array from index.php
  24.  
  25. echo $username."<br/>"; //prints the username
  26. echo $password; //prints the password ;) Don't recommend to do in real life
  27.  
  28.  
  29. //Alternative code to print all values that superglobal POST array stored.
  30. echo "<pre>";
  31. print_r($_POST); //prints the values in format of arrays which stores all values of POST method type form in index.php
  32. echo "</pre>";
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement