PHP POST Method

The POST method transfers information via HTTP headers. The information is encoded as described in case of GET method and put into a header called QUERY_STRING.

Code

<?php
   if( $_POST["username"] || $_POST["email"] ) {
      echo "Username". $_POST['username']. "<br />";
      echo "Email ". $_POST['email']. ";      
      die;
   }
?>
<html>
   <body>
   
      <form action="" method = "POST">
         Username: <input type = "text" name = "username" />
         Email: <input type = "text" name = "email" />
         <input type = "submit" />
      </form>

   </body>
</html>

Leave a Reply

Your email address will not be published. Required fields are marked *