4m1nh4j1
4m1nh4j1

Reputation: 4356

Flask + Jinja and POST/GET variables

How can I use Jinja2 and Flask to get the hidden variable in this code:

<form action="reservation" method="post" name="reservation">

    <td><button type="button" class="btn btn-primary">Reservation</button></td>
    <input type="hidden" name="id" value="{{ d[0] }} ">

</form>

It would be better may be to use GET but I am stuck with this also.

Upvotes: 1

Views: 3788

Answers (1)

Martijn Pieters
Martijn Pieters

Reputation: 1124388

It is just another form field. It may be hidden in your browser, but it is still sent to your Flask server just like any other field.

As such, it'll be found in your request.form multidict:

id = request.form.get('id')

Upvotes: 4

Related Questions