Full width home advertisement

Welcome Home

Post Page Advertisement [Top]

HTML Forms

HTML Forms are used to collect certain information from the site user or visitor. Such as

-registration information
-login information
-contact information
-email address 
-credit card, etc.

Forms take everything typed by the user in the form fields and post it to a back-end application or server-side language, such as PHP, JSP, ASP or CGI etc.

List of form elements 
<form>Defines an HTML form for user input
<input>Defines an input control
<textarea>Defines a multiline input control (text area)
<label>Defines a label for an <input> element
<fieldset>Groups related elements in a form
<legend>Defines a caption for a <fieldset> element
<select>Defines a drop-down list
<optgroup>Defines a group of related options in a drop-down list
<option>Defines an option in a drop-down list
<button>Defines a clickable button
<datalist>Specifies a list of pre-defined options for input controls
<keygen>Defines a key-pair generator field (for forms)
<output>Defines the result of a calculation

The HTML <form> tag is used to create an HTML form and it has following syntax:

<form action="Script URL" method="GET|POST">

form elements like input, textarea etc.


HTML Form Attributes

Apart from common attributes, following is a list of the most frequently used form attributes:

Method is the method to be used to upload data. The most frequently used are GET and POST methods.

Set the target window or frame where the result of the script will be displayed. It takes values like _blank, _self, _parent etc.
The server-side or backend script ready to process your passed data.
The enctype attribute can be used to indicate how the browser encodes the data before it sends it to the server. Possible values are:
Application/x-www-form-urlencoded: This is the general standard method most forms use in simple scenarios.
Mutlipart/form-data - This is used when you want to upload binary data in the form of files such as image, word file etc.

Reference: Tutorials Point / W3Schools

No comments:

Post a Comment

Bottom Ad [Post Page]