Advertisement
karlakmkj

Basic form - POST method

Sep 16th, 2021
797
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.47 KB | None | 0 0
  1. <html>
  2. <body>
  3. <form method="post"> // if using get, change to get
  4. Favorite Color:
  5. <input type="text" name="color"> //must give name to the input
  6. <br>
  7. Favorite Food:
  8. <input type="text" name="food">
  9. <br>
  10. <input type="submit" value="Submit">
  11. </form>
  12. <br>
  13. <p>Best food is: <?=$_POST['food']?></p> //php is here - type ?= instead of ?php echo as shortform to print superglobals
  14. <p>Best color is: <?=$_POST['color']?></p>
  15. <a href="index.php">Reset</a>
  16. </body>
  17. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement