Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML HTML Forms Organizing Forms Add Labels

what exactly did I do wrong here?

i put email down for id then it ask for name I put name down for id then it ask for email what did I do wrong?

index.html
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>HTML Forms</title>
  </head>
  <body>

    <form action="index.html" method="post">
      <label for="name">name:</label>
      <input type="email" id="email" name="user_email">
      <label for="comment">comment:</label>
      <input type="text" id="name" name="user_name">
      <textarea id="comment" name="user_comment"></textarea>
      <button type="submit">Submit Comment</button>
    </form>

  </body>
</html>

Your structure is odd. You have a label for name, then an input for email, then a label for comment and an input for name, then a text area for comments, so it seems like you are ordering them wrong, and missing a label.

3 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

Try spacing out your groups of labels and form fields so you can better see what's going on.

The label should immediately precede its matching form field, so the form field for the name should go directly under its label.

I think i get what you mean you believe that i should separate out the labels to make it to where its easier to read

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

I believe it will help, yes! :-)

It's just about making code easier to read. The Code/browser interpreter doesn't care about it but doing this means you can read the elements and see what's missing, or not needed.

I see what you mean I will try to fix this and come back