Forms Basics
๐ Covered in this chapter:
<form> Tag ยท action & method (GET vs POST) ยท <label for=""> ยท <input> & <button> ยท <textarea> ยท <select> & <option> ยท <fieldset> & <legend>
Welcome to Phase 7 (Chapter 16): Forms Basics! Forms enable user input submission to backend servers. In this chapter, we master
<form>, action URLs, GET vs POST methods, explicit <label for=""> association, textareas, selects, and fieldset grouping.
1Form Submission Syntax & Label Association
HTML โ Complete Form Syntax
โถ Run in HTML Editor
<form action="/submit-form" method="post">
<fieldset style="border:1px solid #f97316; padding:15px; border-radius:8px;">
<legend style="color:#f97316; font-weight:bold;">User Registration</legend>
<p>
<label for="username">Username:</label><br>
<input id="username" name="user" type="text" required>
</p>
<p>
<label for="country">Country:</label><br>
<select id="country" name="country">
<option value="in">India</option>
<option value="us">United States</option>
</select>
</p>
<button type="submit" style="background:#f97316; color:#fff; padding:8px 16px; border:none; border-radius:4px; cursor:pointer;">
Register Now
</button>
</fieldset>
</form>