Advertisement
karlakmkj

Form handling - show output (php)

Sep 20th, 2021
1,057
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.61 KB | None | 0 0
  1. <html>
  2.     <body>
  3.         <form method="post" action="">
  4.             Your name:
  5.             <br>
  6.         <input type="text" name="name">
  7.             <br><br>
  8.         What is the best thing about learning to code:
  9.         <br>
  10.         <input type="text" name="best">
  11.         <br><br>
  12.         <input type="submit" value="Submit Answers">
  13.         </form>
  14.        
  15.      <!-- Using PHP to print output that user entered in the form -->
  16.     <div id="form-output">
  17.     <p id="name"> Hello, <?= $_POST["name"]?>! </p>  <!-- input name from above -->
  18.     <p id="best"> I am glad you enjoy <?= $_POST['best']?>. </p>
  19.     </div>
  20.         <a href="index.php">Reset</a>
  21.     </body>
  22. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement