HTML Forms
An HTML form is used to collect user input. The user input is most often sent to a server for processing.
The <form> Element
The HTML <form> element is used to create an HTML form for user input:
|
1 2 3 4 5 |
<form> . form elements . </form> |
The <form> element is a container for different types of input elements, such as: text fields, checkboxes, radio buttons, submit buttons, etc.
The HTML <form> Elements (Core Concept)
The HTML <form> element can contain one or more of the following form elements:
- <form>
<input><label><textarea><button>
The <input> Element
One of the most used form elements is the <input> element.
The <input> element can be displayed in several ways, depending on the type attribute.
Example
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<!DOCTYPE html> <html> <body> <h3>The input Element</h3> <form action="/action_page.php"> <label for="fname">First name:</label><br> <input type="text" id="fname" name="fname"><br><br> </form> </body> </html> |
Result