KodingKaro
HTML · Beginner · HTML Forms

Textarea, select, buttons, and submission

A form uses different controls for short text, longer messages, choices, and actions.

✓ What you will learn in this topic

  • Explain the purpose of Textarea, select, buttons, and submission in a real HTML document.
  • Choose and apply the elements shown in both examples.
  • Recognize the specific mistake described in this lesson.

Concept explanation

Textarea accepts multi-line text. Select groups options when the user chooses one or more predefined values. Button type=\"submit\" submits the form; type=\"button\" does not submit by default and is useful for other interactions. GET places submitted values in the URL, making it suitable for searches; POST sends them in the request body and is commonly used for changes. Neither method replaces server-side validation or HTTPS.

Syntax

Put controls within form, set action and method intentionally, and choose a button type explicitly.

Example 1: a small page

Textarea gives space for a longer response and the button submits its containing form.

<label for=\"message\">Message</label>
<textarea id=\"message\" name=\"message\" rows=\"4\"></textarea>
<button type=\"submit\">Send</button>

Expected result: A multi-line message field and Send button appear.

Example 2: a practical page

A GET form makes the selected search available in the URL for bookmarking or sharing.

<form action=\"/class-search\" method=\"get\">
  <label for=\"level\">Class level</label>
  <select id=\"level\" name=\"level\"><option value=\"all\">All levels</option><option value=\"intro\">Introductory</option></select>
  <button type=\"submit\">Find classes</button>
</form>

Expected result: A class-level selector submits the selected value to /class-search.

Common mistakes

Every control that should be submitted needs a name, and every input needs a programmatically associated label.

Best practices

Use labels, purpose-matching input types, clear names, and server-side validation in addition to browser checks.

Practice exercise

Build a registration form with name, email, password, experience level, and an optional message. Label each control and explain whether GET or POST fits.

Lesson summary

  • Choose controls for the data, and choose GET for retrieval-style searches or POST for changes.
  • Use labels, purpose-matching input types, clear names, and server-side validation in addition to browser checks.

Knowledge check

Which method commonly suits a shareable search form?

Show the explanation

GET places search values in the URL, which can be bookmarked and shared.

Practical example

html
<label for=\"message\">Message</label>
<textarea id=\"message\" name=\"message\" rows=\"4\"></textarea>
<button type=\"submit\">Send</button>

Expected result:

A multi-line message field and Send button appear.

Hands-on practice task

Build a registration form with name, email, password, experience level, and an optional message. Label each control and explain whether GET or POST fits.

In this section

Other lessons in HTML Forms

Broaden your knowledge

Related learning topics