How to get the name of a submitted form in Flask?
There is no 'name of the form'. That information is not sent by the browser; the name
attribute on <form>
tags is meant to be used solely on the browser side (and deprecated to boot, use id
instead).
You could add that information by using a hidden field, but the most common way to distinguish between forms posting to the same form handler is to give the submit button a name:
<submit name="form1" value="Submit!"/>
and
if 'form1' in request.form:
but you could also use a <input type="hidden">
field to include the means to distinguish between forms.