Form tag

Google Advertisements

Prev Tutorial Next Tutorial

Form tag

This element is used to create a form on html page. which is a logical grouping of controls available on the page. Form contains controls such as text fields, email field, password fields, checkboxes, button, radio buttons, submit button, menus etc.

Attribute of form tag

  • name: are used for provide a name to the form
  • action: are used for specify the page to which the data of current page has to be submitted.
  • method: are used for specify which method to use for submitting this page to server (get or post).

Why use form tag ?

Form tag are used for get the information from user, for example when you fill the registration form lot of information given by use and these information server get from web page using form element.

Syntax of form tag

Syntax

 <form>
 //input controls e.g. textfield, checkbox, button, radiobutton
 </form>

Form tag

TagDescription
<form>It defines an HTML form to enter inputs by the used side.
<input>It defines an input control.
<textarea>It defines a multi-line input control.
<label>It defines a label for an input element.
<fieldset>It groups the related element in a form.
<legend>It defines a caption for a <fieldset> element.
<select>It defines a drop-down list.
<optgroup>It defines a group of related options in a drop-down list.
<option>It defines an option in a drop-down list.
<button>It defines a clickable button.

TextField

Example

<html>
<head>
 <form>
  First Name: <input type="text" name="firstname"/> <br/> 
  Last Name:  <input type="text" name="lastname"/>
 </form>
</body>
</html>

Result

First Name:
Last Name:

Password Field

Example

<html>
<head>
 <form>
  <label for="password">Password: </label>  
  <input type="password" id="password" name="password"/>
 <form>
</body>
</html>

Result

Email Field

Example

<html>
<head>
 <form>
  <label for="email">Email: </label>
  <input type="email" id="email" name="email"/>
 <form>
</body>
</html>

Result

Checkbox

Checkbox are used for select multiple option from list of given options.

Example

<html>
<head>
 <form>
Language Known:<br>
<input type="checkbox" id="hindi" name="hindi" value="hindi"/> 
<label for="hindi">HIndi</label>
<input type="checkbox" id="english" name="english" value="english"/> 
<label for="english">English</label>
<input type="checkbox" id="french" name="french" value="french"/>  
<label for="french">French</label>
 <form>
</body>
</html>

Result

Language Known:

Radio Button

Example

<html>
<head>
 <form>
  <label for="gender">Gender: </label>
  <input type="radio" id="gender" name="gender" value="male"/> Male
  <input type="radio" id="gender" name="gender" value="female"/> Female
 <form>
</body>
</html>

Result

Male Female

Textarea

<textarea> tag are used for write multiple line text in any input area.

Example

<html>
<head>
 <form>
 Write below:<br/>
  <textarea rows="5" cols="40">
  </textarea>
<form>
</body>
</html>

Result

Write below:

Browser supported

Element
<form>YesYesYesYesYes

Prev Tutorial Next Tutorial

Google Advertisements

Buy This Ad Space @$50 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 8076671483

Pure VPN Privide Lowest Price VPN Just @ $1.65. Per Month with Non Detected IP Lowest Price Non Detected IP VPN

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

Cloud computing is the on demand availability of computer system resources, especially data storage and computing power, without direct active management by the user. Cloud Computing Tutorial

College Projects Related to Java, AWT, C Projects for College, C++ Projects for College, Android Projects. Download Java C C++ Projects

Download Projects

Adsense Advertisements


Buy This ads Space 8076671483

Buy This Ad Space @$120 per Month, Ad Size 300X600 Contact on: hitesh.xc@gmail.com or 8076671483 Try this Keyword C++ Programs