Reputation: 969
I have the following HTML code. It creates a form and once i hit submit, POST a request to the server.
<html>
<body bgcolor = black text= white>
<FORM method="post" action="/processData.py">
<P>
<LABEL for="firstname">First name: </LABEL>
<INPUT type="text" id="firstname"><BR>
<LABEL for="lastname">Last name: </LABEL>
<INPUT type="text" id="lastname"><BR>
<LABEL for="email">email: </LABEL>
<INPUT type="text" id="email"><BR>
<INPUT type="radio" name="sex" value="Male"> Male<BR>
<INPUT type="radio" name="sex" value="Female"> Female<BR>
<INPUT type="submit" value="Send"> <INPUT type="reset">
</P>
</FORM>
</body>
</html>
When i hit submit i get a POST http request on my web server. But instead of getting the values for all the fields. I am getting only the radio button value. Here is the header i am getting:
POST /Test.html HTTP/1.1
Host: 127.0.0.1:22222
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8) AppleWebKit/536.25 (KHTML, like Gecko) Version/6.0 Safari/536.25
Content-Length: 10
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*//*;q=0.8
Origin: http://127.0.0.1:22222
Content-Type: application/x-www-form-urlencoded
Referer: http://127.0.0.1:22222/File.html
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: keep-alive
sex=Female
I was expecting the data to show up after the header. why is it not showing?
Upvotes: 1
Views: 570
Reputation: 55972
i think you need to define name
attributes for all inputs
right now only the radio's have names
<INPUT type="radio" name="sex" value="Male"> Male<BR>
<INPUT type="radio" name="sex" value="Female"> Female<BR>
give name attribute:
<LABEL for="lastname">Last name: </LABEL>
<INPUT type="text" id="lastname" name="lastname"><BR>
Upvotes: 2