I am trying to submit information from a web form in python using a bottle. I use get to send the variable "test", but when I call the query function for "test", it does not return anything. I am using a bottle tutorial as my reference.
Here is my web form:
<form action="http://localhost:8080/page" method="get">
<input type="number" name="test" step="5">
<input type="submit" name="my-form" value="GO">
</form>
If you enter 1 in the field and click go, this will result in the following URL:
http://localhost:8080/page?test=10&my-form=GO
And here is the python code for the bottle:
@route('/page', method='GET')
def index():
testvar = request.forms.get('test')
return 'Hello %s' % testvar
From what I understand, request.forms.get ('test') should extract the value from test = 10 in the url and pass it to testvar. However, I get a value of none, i.e. var is empty.
Thanks!
source
share