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!

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 Form Basics Create a Text Input

is this <form action = "index.html" method = "post"> addressing action

please provide example if I am wrong

<!DOCTYPE html>
    <meta charset="utf-8">
  <title>HTML Forms</title>
     <form action = "index.html" method = "post">
       <input type = "text" id + "name" name = "user_name">


1 Answer

Balazs Peak
Balazs Peak
46,157 Points

I can see 3 problems here:

  • you have began the form element 2 times. When you begin, you can add the attributes, no need to begin separately.
  • you have put the input element outside of the scope of the form. That is incorrect, the element responsible for launching the HTTP post method must be inside the scope of the form of what it is posting data from.
  • you have mixed up the attributes of the input element as well. I think you just wanted to complicate it too much and it is simpler actually than you have expected :)

You should do something like this:

    <form action="index.html" method ="post">
        <input type="text" id="name" name="user_name">