Php Simple Form

Here We give simple HTML Form with Php code.

Html Form with POST Method it will display the value of Full Name and Email Address.

You need to create two (.php) file to execute this code.

First is simple.php and other is insert.php to perform this task.

PHP Simple Form example teach you how to make basic form with PHP and HTML.

In this you learn how to store data from a PHP Form and see result.

In this example form creating with HTML and data will get through PHP.

Make sure your form Start with tag and End with tag same as in PHP it will Start and End with .

In HTML, a form is Start with Form and End with tag.

In this example we take two textbox (1) Full Name and (2) Email and we take Form Method is POST.

Two types of Form Methods (1) POST and (2) GET.

In this example we take TWO Form like 1st is index.php and 2nd is insert.php

When User fills Form Data and click on the Submit Button, the Form Data will send for processing to a PHP file named “insert.php”.

In PHP there are so many ways to display data of Form. You can save tae data in Database and then you also Display.

But it is Basic or Simple PHP example so that we only “echo” or “print” data of Form.

In this you also Validate Both Fields.

Now a Days So Many Form Builder or Form Generator Websites available on Internet so you have to write only PHP code for that Form.

Websites like :

(1) Bootsnip

(2) formden

(3) jqueryform

(4) Fuel Ux

Display User Submitted Data with “echo” all data with insert.php like below code :

Code of index.php


<html>
<body>
<h1>Sample HTML Form</h1>
<form action="insert.php" method="post">
FullName:<input type="text" name="fullname"><br>
E-mail Address: <input type="text" name="email"><br>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>

Code of insert.php


<?php
echo 'Your Fullname is: '.$_POST['fullname'];
echo '<br/>';
echo 'Your Email address is: '.$_POST['email'];
?>

User Fills all data and press Submit Button then they get Answer like this.

1

2

Leave a Reply