An HTML form is an element used to collect user input and send it to a server. Forms can contain various input elements such as text fields, buttons, checkboxes, and more.
Form elements:
<input type="text">
- A text field for entering short text data.<textarea>
- A text area for entering longer text data.<select>
- A dropdown list for selecting one of many options.<button>
- A button for submitting the form or performing another action.<input type="checkbox">
- A checkbox for selecting or deselecting an option.<input type="radio">
- Radio buttons for selecting one option from a group.<input type="submit">
- A button for submitting the form.
Example of an HTML form:
<form action="/submit" method="post"> <label for="name">Name:</label> <input type="text" id="name" name="name"> <br> <label for="message">Message:</label> <textarea id="message" name="message"></textarea> <br> <input type="submit" value="Submit"> </form>