element defines an HTML form and contains input elements like text fields, checkboxes, and radio buttons. Common input types include single-line text, checkboxes, radio buttons, and submit buttons. Labels are paired with inputs for accessibility. The name attribute is required for inputs to be successfully submitted."> element defines an HTML form and contains input elements like text fields, checkboxes, and radio buttons. Common input types include single-line text, checkboxes, radio buttons, and submit buttons. Labels are paired with inputs for accessibility. The name attribute is required for inputs to be successfully submitted.">
HTML Forms
HTML Forms
By
Walujjo stephen
• An HTML form is used to collect user input. The
user input is most often sent to a server for
processing.
The <form> Element
<form>
<input type="radio" id="html" name="fav_language“
value="HTML">
<label for="html">HTML</label><br>
<input type="radio" id="css" name="fav_language“
value="CSS">
<label for="css">CSS</label><br>
<input type="radio" id="javascript" name="fav_language“
value="JavaScript">
<label for="javascript">JavaScript</label>
</form>
Checkboxes
The <input type="checkbox"> defines a checkbox.
If the name attribute is omitted, the value of the input field will not
be sent at all.
Example
This example will not submit the value of the "First name" input
field:
<form action="/action_page.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" value="John"><br><br>
<input type="submit" value="Submit">