Web development
Labels and Form Inputs
Updated Oct 28, 2026
A form can collect information with controls such as input and button. Give each input a visible label associated through matching for and id attributes. A name identifies the control when the form is
What you’ll learn
Learn and practise labels and form inputs.
Explanation
A form can collect information with controls such as input and button. Give each input a visible label associated through matching for and id attributes. A name identifies the control when the form is submitted. Labels remain important even if an input has placeholder text.
Form ប្រើប្រមូលព័ត៌មាន។ ភ្ជាប់ label និង input ដោយ for និង id ដែលដូចគ្នា។ name ជាឈ្មោះទិន្នន័យពេលផ្ញើ form។ កុំប្រើ placeholder ជំនួស label តែមួយ។
Worked example
<label for="name">Name</label><input id="name" name="name"><button type="submit">Send</button>
Practice
- How is the label connected to the input?
- Explain the same idea using your own example.
Answers and guidance
Show answers / បង្ហាញចម្លើយ
- The label’s for value matches the input’s id.
- Answers vary. Check your explanation against the lesson.
Quick recap
A form can collect information with controls such as input and button.