<?php

/**
* Simple PHP Form - POST
*
* This script demonstrates how to post a form.
* 
* @author		Blaze Script
* @website		https://blazescript.com
* @date			January 2019
*/

// Check if form posted
if (!empty($_POST)) {
   // Function to Clean Input
   function clean_input($data) {
     $data = trim($data);
     $data = stripslashes($data);
     $data = htmlspecialchars($data);
     return $data;
   }

   // Get posted data
   $name = $_POST['name'];
   $email = $_POST['email'];

   // Clean posted data
   $name = clean_input($name);
   $email = clean_input($email);

   // Display result
   echo "Form was successfully submitted. Here is what you sent:<br>";
   echo "Name: ".$name."<br>";
   echo "Email: ".$email."<br>";
}

?>

<html>
<head>
</head>
<body>

   <form action=<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?> method="post">
        Name: <input type="text" name="name"><br>
        Email: <input type="text" name="email"><br>
        <input type="submit">
    </form>
</body>
</html>