How to print HTML form data using php

HTML code

<html>
<head></head>
<bosy>
<form action = "<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method = "POST">
<input type = "text" name = "first_name" id = "first_name">
<input type = "text" name = "last_name" id = "last_name">
<input type = "text" name = "emailed" id = "emailed">
</form>
</body>
</html>

PHP Code

<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
  echo "First Name ". $_POST['first_name'];
  echo "Last Name ". $_POST['last_name'];
  echo "Email ". $_POST['emailid'];  
}
?>

Published by deeps blog

Programmer

Leave a comment

Design a site like this with WordPress.com
Get started