I want to take data from html form with the python flask and send data back at the same html file. Can you help me with an example or some tips? Thank you.
Asked
Active
Viewed 510 times
1 Answers
1
You can use request.form, like the following:
from flask import Flask, request
app = Flask(__name__)
@app.route('/path_form_submits_to', methods=['POST'])
def my_handler():
return request.form.get("field_name", "default value if field isn't there")

Flight Odyssey
- 2,267
- 18
- 25