In the Flask code you can add an action under every if statement of the corresponding button like rendering a template or running a python script. In the HTML code you can add as many buttons as you want just be sure to add the right values and names.
Flask Code
from flask import Flask, render_template, request app = Flask(__name__) @app.route("/", methods=['GET', 'POST']) def index(): if request.method == 'POST': if request.form.get('action1') == 'VALUE1': pass # do something elif request.form.get('action2') == 'VALUE2': pass # do something else else: pass # unknown elif request.method == 'GET': return render_template('index.html', form=form) return render_template("index.html")
In the HTML Code (index.html)
<h3>Our Flask Buttons<h3/> <form method="post" action="/"> <input type="submit" value="VALUE1" name="action1"/> <input type="submit" value="VALUE2" name="action2" /> </form>