Kanbritech Learn logo
HTML HTML Forms 45h track

HTML Form Elements

Add a checkbox requesting a reminder, with a submitted value of yes.

Understand the topic

Forms can contain inputs, selects, textareas, buttons, and grouped controls. fieldset and legend provide a group name for related choices. A label can reference a control by id or wrap it directly. Use appropriate controls rather than asking people to type every answer manually. output can represent a calculated result but does not replace submission logic.

Worked example

<form>
<fieldset><legend>Choose a workshop</legend>
  <label><input type="radio" name="course" value="html" checked> HTML</label>
  <label><input type="radio" name="course" value="css"> CSS</label>
</fieldset>
<label for="session">Session</label><select id="session" name="session"><option value="morning">Morning</option><option value="evening">Evening</option></select>
<br><label for="notes">Access requirements</label><br><textarea id="notes" name="notes" rows="3"></textarea>
</form>

Both radio inputs share a name so only one can be selected. The legend identifies the group and the other controls have explicit labels.

Practice

Add a checkbox requesting a reminder, with a submitted value of yes.

Show a suggested answer
<label><input type="checkbox" name="reminder" value="yes"> Send me a reminder</label>

Common mistake

Unchecked checkboxes are normally absent from form data. Do not assume they submit a false value automatically.

HTML documentation

Live Example

Try Coding

Result