Simple form Submission
Home Courses Community Support
Simple form Submission

Well, We are working on form handling in PHP. The form we will use is HTML form but PHP is required to take action on that form.

Do create a simple HTML form using below code-

<!doctype HTML>
<head> <title> Simple Form Submission</title> </head>
		<form action="about.php" method="post">
        Enter Your Name: <input type="text" name="n"> <br>
        Enter Your Address: <input type="text" name="add"><br>
        <input type="submit">

In the above code we have used a page about.php to handle HTML form and use a post method for that. This form will allow you to enter your Name, your address and will provide a submit button. When you will click on submit, it will process the request by using script written on about.php. This page will receive entered data in form by post method.

Let's create the page about.php to handle the form-

<!doctype HTML>
<head> <title> Simple Form Handler</title> </head>
		<p>Welcome to Geeksdemy</p>
        Welcome <?php
		echo "& ".$_POST["n"];
        Your Address is <?php
		echo "& ".$_POST["add"];

This page has the data received from from. So we just need to process that data. We print both entered values on about.php page. To print the value we use input names, which were defined in form i.e. 'n' for Name and 'add' for address. (We can give any name to input field.)

Practice this simple code on your machine. In next heading we will learn to create enquiry form for websites.

Post vs Get

In above form we have used Post method to submit the form. Another method to submit the form is Get method.

Below are some differences in both method-

Sl. No. Get Post
1 Submitted data pass in URL Submitted data does not pass in URL
2 Form parameters saved in browder history because data is a part of URL. Form parameters are not saved in browser history
3 It can be bookmarked by user It can not be bookmarked by user.
4 Maximum 2048 characters can be send because the data pass in URL and URL can not exceed this length. Any number of characters can be send.
5 Only ASCII characters are allowed. No such restriction.
6 Get is less secure Post is more secure
7 Data can be cached

Data can not be cached


← Preview

Creating Links for Webpage Redirections

Next →

Designing Enquiry Form


Our mission is to provide highly effective and quality education via innovative solutions. Geeksdemy look forward to bridge the gap between in-demand technology and academics in order to deliver innovative, easy, interesting and affordable learning across the Globe.


  • Python
  • Game Development with Unity 3D
  • Arduino
  • PCB & Circuit Designing
  • Robotics and Embedded C
  • 8051/8052 Embedded Systems
  • QuadCopter & UAV
  • MATLAB with Robotics
  • Raspberry Pi
Learn On the Go!
Get the Android App
Get the iOS App