How to create HTML Form
In this tutorial, we will learn about How to create HTML Form. So far we have discussed how to create a frame, tables, List, insert Images, Linking in HTML etc. HTML Form is one of the most important part of the websites Every website has Contact forms or feedback forms.. Filling the Digital forms saves time, cost of printing, and paperwork Before learning about how to create a Form lets understand what is a form?
What is a form?
Dictionary meaning of the form is a blank document or template to be filled in by the user, in the same way as HTML Forms. HTML Forms are used to gather/collect information about an user or customer, such as his or her e-mail address, name, address, phone, date of birth and, educational qualification etc.
<form></form> tag is used to create the HTML Form as given below.
Attributes of <form> tag
1. Action = "abc.php" - The action to be performed when the form is submitted.
2. Method="Post" or "Get" - By default, the method is Get. It is used to display the submitted form data in the address bar of the browser. If the user changes the method to post then the submitted form data will not appear in the address bar of the browser. It is used to send a large amount of data in one go.
2. <input type="radio"> Radio is used to create radio button. It is used to select only one
option from multiple options.
3. <input type="submit"> Submit button is used to submit the form.
4. <input type ="checkbox"> Checkbox is used to create Checkbox. It is used to select multiple.
Atributes of <input> tag
Text in the Form
Text is used to enter single line data i.e. not more than 255 characters.
Example:
The output is :
Radio Button in the Form
Radio button is used to select only one option out of many option.
Example:
Output is
Text Area in the Form
Textarea it is used to enter the multi-line text.
Atributes of Textarea:
Output is
<form action="abc.php" method="">
----------
---------
</form>
1. Action = "abc.php" - The action to be performed when the form is submitted.
2. Method="Post" or "Get" - By default, the method is Get. It is used to display the submitted form data in the address bar of the browser. If the user changes the method to post then the submitted form data will not appear in the address bar of the browser. It is used to send a large amount of data in one go.
Form Controls
<Input> :
<input> tag is used to create interactive controls using type attributes.
1. <input type="Text"> Text is used to enter single line data. i.e. not more the 255.2. <input type="radio"> Radio is used to create radio button. It is used to select only one
option from multiple options.
3. <input type="submit"> Submit button is used to submit the form.
4. <input type ="checkbox"> Checkbox is used to create Checkbox. It is used to select multiple.
Atributes of <input> tag
- Type="radio" / "text"/"checkbox"/"submit"
- Name="name of the element"
- Value= "text" - specifies the default value.
- Maxlength=value - Specifies the maximum number of characters in the text box.
- Size=value - Specifies the width of the text box.
Text is used to enter single line data i.e. not more than 255 characters.
Example:
How to create form- Text |
How to create form - text |
Radio Button in the Form
Radio button is used to select only one option out of many option.
Example:
Output is
How to create form - radio button |
Output is :
How to create form - Radio button |
Textarea it is used to enter the multi-line text.
Atributes of Textarea:
- name="name of the textarea"
- rows=value - Numbers of rows.
- cols=value - Numbers of column.
To create form using Textarea |
How to create form using Textarea |
Comments
Post a Comment