Python flask multiple buttons code example
Example: two buttons on html page flask
<form method ="post" action="/">
<button type="submit" name="submit_a" value="submit_a"> Submit_a </button>
<button type="submit" name="submit_b" value="submit_b"> Submit_b </button>
</form>
def submit():
if request.method == "POST":
if request.form.get("submit_a"):
# do something
elif request.form.get("submit_b"):
# do something else
elif request.method == "GET":
# do something