1@app.route('/form-example', methods=['GET', 'POST']) #allow both GET and POST requests
2def form_example():
3 if request.method == 'POST': #this block is only entered when the form is submitted
4 language = request.form.get('language')
5 framework = request.form['framework']
6
7 return '''<h1>The language value is: {}</h1>
8 <h1>The framework value is: {}</h1>'''.format(language, framework)
9
10 return '''<form method="POST">
11 Language: <input type="text" name="language"><br>
12 Framework: <input type="text" name="framework"><br>
13 <input type="submit" value="Submit"><br>
14 </form>'''