Forms in HTML5 | Forms Example
Forms in HTML5: Forms used to accept user input.
Forms in HTML is used to accept user input. The form in html is created by using <form> element as <form></form>.
<Form>
.
Form elements
.
</form>
Form controls | Elements:
A form is a collection of different elements also called as controls like textbox, radio button, and checkbox, submit button, password, reset button and many more. Attributes used with form element and Input element.
The <form> element is a container for different types of input elements, such as: text, checkboxes, radio buttons, submit buttons, etc.
<Form> tag can have following attributes
Name: It specifies a name to a form.
Action: The action attribute specifies the path where the form is to be submitted. When user clicks on submit button if the action attribute is committed, the action is set to the current page.
Method: The method attribute specifies get or post method to be used when submitting the form data.
Method of form are GET or POST.
- i) GET method: The default method of submitting form data is GET. The data submitted by using GET is visible in the address bar. It is better for data which is not sensitive. The number of characters in GET method depends on browser.
- ii) POST Method: The POST method of sending data does not display the form data in the address bar. So it is a secure method to submit sensitive or personal It does not have size limitations as in GET method.
<Form> Example
<!DOCTYPE html>
<html>
<head><title>Form with Input elements</title></head>
<body bgcolor=”orange”>
<h1>use of form</h1>
<form >
Enter your name <input type=”text” Name=”n1″ maxlength=”20″><Br>
<input type=”submit” value=”Submit”><br>
</form></body></html>
Web Title: Forms in HTML5