I have a page with nothing on it but this form:
<form method="post" action="/sign-in">
<input type="text" id="username" />
<input type="password" id="password" />
<input type="submit" />
</form>
After entering values into “usernamed” and “password”, when the form is submitted via the submit button, I get this HTTP header:
POST http://localhost:12339/sign-in HTTP/1.1
Host: localhost:12339
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12)...
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://localhost:12339/
Cookie: Authorization=test
Content-Type: application/x-www-form-urlencoded
Content-Length: 0
My question is, why aren’t the “username” and “password” form field values being posted in the content of the HTTP post?
When sending form data, the names are retrieved from the
nameattribute, not from theid. Try this:Or, if you need the id for something else: