HTML Forms
HTML forms are used to collect user input. A form contains form elements like input fields, checkboxes, radio buttons, text areas, and more.
Basic Form Structure
<form action="/submit" method="post">
<!-- form elements go here -->
</form>
Common Form Elements
Text Inputs
<input type="text" placeholder="Your name">
<input type="email" placeholder="Your email">
<input type="password" placeholder="Password">
<input type="number" placeholder="number">
<input type="date" >
<input type="search" placeholder="search...">
Text Area
<textarea rows="4" cols="50">Write your message here...</textarea>
Radio Buttons and Checkboxes
<input type="radio" name="gender" value="male"> Male
<input type="radio" name="gender" value="female"> Female
<br>
<input type="checkbox" name="subscribe"> Subscribe to newsletter
Select Dropdown
<select name="fruit">
<option>Apple</option>
<option>Banana</option>
<option>Mango</option>
</select>
File Upload
<input type="file">
Submit and Reset
<input type="submit" value="Submit">
<input type="reset" value="Reset">