Saturday, November 14, 2020

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 jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

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 www.jakerpomperada.blogspot.com and www.jakerpomperada.com

Your support on my channel is highly appreciated.

Thank you very much.




Program Listing

index.php

<html>

  <head> 

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

  </head>

  <body> 

    <style type="text/css">

      

      body {

        font-family: arial;

            size: 12px;

      };

    </style>

   

   <?php

     $display="";

     $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 : " . 

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

      $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>

   <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" />

   &nbsp;&nbsp;&nbsp;

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

</form>

  <?php


    echo $display;

   ?> 

 </body>

 </html>

1 comment: