HTML Form
<form>
The <form> element is used to collect user input on a webpage.
Syntax:
<form action="url" method="post">form elements here
</form>
Example:
Output:
Form Attributes
action - URL where the form data is sent
method - HTTP method used when sending form data (GET or POST)
target - specifies where to open the response
Common Form Input Types
<input type="text">
Creates a single-line text input.Syntax:
<input type="text">Output:
<input type="password">
Hides characters as the user types.Syntax:
<input type="password">Output:
<input type="radio">
Allows selecting **one** option.Syntax:
<input type="radio" name="choice">Output:
<input type="checkbox">
Allows selecting **multiple** options.Syntax:
<input type="checkbox">Output:
<select>
Creates a dropdown list.Syntax:
<select><option>Item</option>
</select>
Output:
<textarea>
Creates a multi-line text box.Syntax:
<textarea rows="4" cols="50"></textarea>Output:
<button>
Creates a clickable button.Syntax:
<button>Click me</button>Output: