I am trying to make an RPG character-sheet using flask. In this project I have two buttons ( level+ and level- ) that add or decrease the level of the character when pressed on.
So I have my html file:
<div class="level">
<button type="button" name="level-">-</button>
<p>{{ level }}</p>
<button type="button" name="level+">+</button>
</div>
and my flask file:
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route('/', methods=['POST', 'GET'])
def index():
level = 0
return render_template('index.html', level=level)
if __name__ == '__main__':
app.run(debug=True)
How do I access the buttons such that I can increment or decrement the level variable in the python file?