Here is how to get checkbox value from jinja2 template in a flask, first let’s create our jinja2 file:
<form action="" method="post"> <input type="radio" id="1" name="rating" value="1"> <label for="1">1</label><br> <input type="radio" id="2" name="rating" value="2"> <label for="2">2</label><br> <input type="radio" id="3" name="rating" value="3"> <label for="3">3</label><br> <input type="radio" id="4" name="rating" value="4"> <label for="4">4</label><br> <input type="radio" id="5" name="rating" value="5"> <label for="5">5</label><br><br> <p><input type=submit value=Next></p> </form>
Then lets retrieve value from the form:
if request.method == 'POST': print(request.form['rating'])
Where rating is the name of input boxes