FORM IN HTML

what is a from ? A from is an HTML elements used to collect data from the user like login,registration,feedback,etc. – the container tag that wraps all form elements – for text, password, email, checkbox, radio, file, submit, etc. _ describes/name an input field _ for multi-line text input _ creates a dropdown list _ defines each item inside a select – groups related s together – clickable button (submit, reset, or custom) – groups related form elements together visually – gives a caption/title
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>
Enter fullscreen mode Exit fullscreen mode
- Input tag: Standard single-line text box
eg:
<input type="text" name="username">
Enter fullscreen mode Exit fullscreen mode
- textarea: Used for multiple lines of text input
eg:
<textarea name="message" rows="4" cols="30"></textarea>
Enter fullscreen mode Exit fullscreen mode
- Select(Dropdown):
<select name="city">
<option value="chennai">Chennai</option>
<option value="mumbai">Mumbai</option>
</select>
Enter fullscreen mode Exit fullscreen mode
- Button:
<button type="submit">Submit</button>
Enter fullscreen mode Exit fullscreen mode
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



