How to get the text input given by a user for an HTML page through python?
e.g.
<html>
<input id="post_form_id" name="fooput" value="" />
</html>
Now, the user inputs the value abcxyz in the text field. How can I get that value using python? I already know how it is done through javascript but I want to do it using python.
Also, I already tried Beautiful Soup but it can only return the preset value of the field.
SO I can do
soup=BeautifulSoup(open("myhtmldoc.htm"))
print soup.find('input')['value']
But this wil only give me the preset value and not the value given by the user.
You need to write a script that is called when the form is submitted. Typically, you use some framework that takes care of the sundry details.
A lightweight framework like
Flaskmakes this task easy:In your
form.html: