what is a from ?
A from is an HTML elements used to collect data from the user like login,registration,feedback,etc.
<form>– the container tag that wraps all form elements<input>– for text, password, email, checkbox, radio, file, submit, etc.<lable>_ describes/name an input field<textarea>_ for multi-line text input<select>_ creates a dropdown list<option>_ defines each item inside a select<optgroup>– groups related s together<button>– clickable button (submit, reset, or custom)<fieldset>– groups related form elements together visually<legend>– gives a caption/title to a
## Common form of elements
- lable tag: The for attribute must match the id of the input field. eg:
<lable for="username">Username:</lable>
- Input tag: Standard single-line text box
eg:
<input type="text" name="username">
- textarea: Used for multiple lines of text input
eg:
<textarea name="message" rows="4" cols="30"></textarea>
- Select(Dropdown):
<select name="city">
<option value="chennai">Chennai</option>
<option value="mumbai">Mumbai</option>
</select>
- Button:
<button type="submit">Submit</button>
GET vs POST
GET
Data is sent visibly in the URL
Used for search, filters, or non-sensitive visible data
Limited amount of data can be sent
POST
Data is sent hidden (in the request body)
Used for sensitive data like login, registration
Can send larger amounts of data
Top comments (0)