I\'m building a website using Flask, and on one page I\'ve got two forms. If there\'s a POST, I need to decide which form is being posted. I can of course deduct it from the
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.