Thursday, 9 April 2015

Introduction to Forms and HTML Controls

HTML is also designed to introduce forms those are also primary part of web page and gather information from the user. The basic function of the form is to allow a user to enter data on one end and send the data on the other end through the server. Forms are used in purchasing goods,sign up for newsletters,mail accounts etc. Each form having a submit button which helps to send data through the server to the action url.

Creating HTML Form :

HTML forms are created by the <form> tag. The attributes use for form tag are action and method. These attributes are used for processing HTML form. Action is used to entering action url and method is used for entering methods which will be use to transferring data to the server. There are to methods which are used in HTML forms POST and GET.

Now i am going to give you an example regarding forms.Let's see :

<title>My First Form</title>
<form action="physical address of server" method="post">
First Name :
<input type="text" name="firstname">
Last Name:
<input type="text" name="lastname">
<input type="submit" value="Submit">

The following page will open on running this html page :


For using form action we should need the server address where we wanna send form data.
<input type="submit"  makes a button which is use for sending data to action url and <input type="text" are used to create text fields for entering data.
Name attribute is used to make both text fields different. These name attribute will use in PHP when we will try to connect database server. This will be the most important part pf the HTML forms.
In next article we will discuss about HTML with javascript.

No comments:

Post a Comment