Learn simple contact form in PHP website

PHP is a server side scripting language. Through PHP you can change a simple website into dynamic website or a dynamic application. PHP is embedded in HTML (Hypertext Markup Language)

Today I’m going to create a simple HTML form in PHP so here we getting start by making a simple form .

Here we first create 2 file –> contactform and form.php.

  • In “ contactform.html ” we create simple HTML form.
  • In Form.php we get user data and print in on another page through PHP.


There are two methods Get and Post we usually use Post method because through POST user data is secure and hide user info from url.




<title> Form in PHP </title>


< body >

<form action=”Form.php” method=”POST”>

<input type=”text” name=”name”/ >

<input type=”text” name=”email”/ >

<input type=”text” name=”address”/ >

<input type=”text” name=”number”/>





Now create 2nd file Form.php.




<?php   echo $_POST [ “ $name ” ] ;     ?>

<?php   echo $_POST [ “ $email ” ] ;     ?>

<?php   echo $_POST [ “ $address ” ] ;       ?>

<?php   echo $_POST [ “ $number ” ] ;       ?>



Through echo we get output of user input from the form text field.