HTML Forms Input and Display in PHP

 In this tutorial I will show you how to create and use HTML forms with PHP programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following,, and

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is and

Your support on my channel is highly appreciated.

Thank you very much.

Program Listing


   <title>HTML Forms Input and Display in PHP</title>



    <style type="text/css">


      body {

        font-family: arial;

            size: 12px;






     $firstname = $_POST['firstname'];

     $middlename = $_POST['middlename'];

     $lastname   = $_POST['lastname'];

   if(isset($_POST['submit'])) {

      $display .= "<h2> Display Results </h2>";

      $display .= "First Name  : " .

                  strtoupper($firstname) ."<br/>";

      $display .= "Middle Name : " . 


      $display .= "Last Name   : " . 

                    strtoupper($lastname)."<br />";


if (isset($_POST['clear'])) {

   $firstname ="";

   $middlename ="";

   $lastname ="";

   $display ="";



    <h2> HTML Forms Input and Display in PHP </h2>

<form method="post">

   <p>First Name: <input type="text" name="firstname"

    value="<?php echo $firstname; ?>" autofocus


   <p>Middle Name: <input type="text" name="middlename"

    value="<?php echo $middlename; ?>"></p>

   <p>Last Name: <input type="text" name="lastname" 

    value="<?php echo $lastname; ?>"></p>

   <input type="submit" name="submit" value="Submit" />


   <input type="submit" name="clear" value="Clear" />



    echo $display;