Form Elements in HTML
A Guide to HTML Forms and Input
Elements
Introduction to Forms in HTML
• Forms in HTML are used to collect user input.
They contain input elements like text fields,
checkboxes, radio buttons, and more.
Basic Form Structure
• Example:
• <form action="submit.php" method="post">
• <input type="text" name="username"
placeholder="Enter Name">
• <input type="submit" value="Submit">
• </form>
Text Input Element
• <input type="text" name="name"
placeholder="Enter your name">
Password Input
• <input type="password" name="password"
placeholder="Enter password">
Radio Buttons
• <input type="radio" name="gender"
value="male"> Male
• <input type="radio" name="gender"
value="female"> Female
Checkboxes
• <input type="checkbox" name="subscribe"
value="yes"> Subscribe to newsletter
Dropdown (Select Element)
• <select name="country">
• <option value="india">India</option>
• <option value="usa">USA</option>
• </select>
Submit & Reset Buttons
• <input type="submit" value="Submit">
• <input type="reset" value="Reset">
Textarea and File Upload
• <textarea name="message" rows="4"
cols="50">Enter message...</textarea>
• <input type="file" name="file">
Conclusion
• HTML forms are essential for user input. They
include text fields, checkboxes, radio buttons,
dropdowns, and more.