-1

my question is what is really happens when you hit the submit button on a html servey like this one?

<INPUT TYPE="radio" NAME="bev" VALUE="no" CHECKED>No beverage<BR>
<INPUT TYPE="radio" NAME="bev" VALUE="tea">Tea<BR>
<INPUT TYPE="radio" NAME="bev" VALUE="cof">Coffee<BR>
<INPUT TYPE="radio" NAME="bev" VALUE="lem">Lemonade<BR>

To be more specific, I mean how does the browser sending the data of my choie to the server, because I want to make a Python code that will vote for me in a HTML survey like this

Daniel
  • 101
  • 3

1 Answers1

1

If the form method attribute is post(which I think is) , then the browser sends a post request.If you're using requests library, this is the code

data = {'bev': 'tea'}
#Define a dict with parameter with keys as name attribute values and value as the content you want to send
r = requests.get("http://awebsite.com/", params=data)
print r.content

Requests docs POST requests
And if you aren't using requests, then God help you write the code.

svineet
  • 1,859
  • 1
  • 17
  • 28