简体   繁体   中英

Flask, Get value from HTML

Super simple question, I'm using flask and I want to get the string value of this array. I know how to use request.fom["name"] , but I cannot assign this variable a name. How would I get this variable to then put it on my next page?

{% for row in students %}
  <form action="{{ url_for('user') }}" method = "POST">
    <tr>
      {{ row[0] }} <br />
      <input type="submit">
      <p> </p> <br />
    </tr>
  </form>
{% endfor %}

I need the value of row[0], how would I assign a name to that, or just get the information?

Assignment is expression and syntax for expressions in jinja follows {% %} . So this should work

{% set data = row[0] %}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM