Friday, 6 February 2015

A form is a section of an HTML document that is marked by <form> tags. A form mostly contains these elements:
  • Input elements where the user enters information, such as a text box for entering text or a check box for selecting an option.
  • A Submit button that the user clicks to send the information to its destination.
  • An optional Reset button that clears the form.

A web page can contain multiple forms, each one being completely independent of the others. In forms, you can control how the data is submitted =. It can be placed in an email message and sent to a specified address, or it can be sent to a specialized program on the server that will process the data.

The <form> Tag
The first step in creating an HTML form is to place a <form> tag on your page. It can be essentially anywhere in the body section (even inside a table cell). The basic syntax is as follows:

<form action='action'>
</form>

The action attribute specified the URL where the form data will be submitted. Do not worry about that now, as we will discuss it soon. The <form> tag has several optional attributes that you may not need to use. There are:

Attributes
Values
Description
Method
Get, post
Use method=get to send the form data in the URL. Use method=post to send the data in the request body. If this attribute is omitted, then get it used.
Name
Text
Defines a unique name for the form. Used Primarily on webpage that contains more than one form.
Target
_blank, _top
Specifies where the results of the submission will display. Use target=”_blank” to open the result in new window. Use target=”_top” to open the result in the same window (default).


0 comments:

Post a Comment