Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //First File
- <html>
- <head>
- <title> Form</title>
- </head>
- <body>
- <!-- HTML Login Form -->
- <form action="form_processing.php" method="post"> <!-- Form method here is 'post' method -->
- Username: <input type="text" name="username" value=""><br/>
- password: <input type="password" name="password" value=""><br/>
- <br/>
- <input type="submit" name="submit" value="Submit"> <!-- When user submits, the form data is posted to form_processing.php -->
- </form>
- </body>
- </html>
- //Second File
- <?php
- $username = $_POST['username']; //Gets the username through the superglobal POST array from index.php
- $password = $_POST['password']; //Gets the password through the superglobal POST array from index.php
- echo $username."<br/>"; //prints the username
- echo $password; //prints the password ;) Don't recommend to do in real life
- //Alternative code to print all values that superglobal POST array stored.
- echo "<pre>";
- print_r($_POST); //prints the values in format of arrays which stores all values of POST method type form in index.php
- echo "</pre>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement