karlakmkj

Form handling - show output (php)

Sep 20th, 2021
811
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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>
RAW Paste Data