title: How to access the value of each checkbox in a table with Flask?
body: <p>I have a table which is populated by</p>
  
  <pre><code> &lt;button type="submit" name="update" value = company.index style = margin-left:45%&gt;Update&lt;/button&gt;
                  ....
                  {% for product in products%}
                      &lt;tr {{product .index}}&gt;
                          &lt;th scope="row"&gt;{{ product .productname }}&lt;/th&gt;
                          &lt;td&gt; {{ product .description }} &lt;/td&gt;
                          &lt;td&gt;&lt;form method = "POST"&gt; &lt;input  type="checkbox" name="checkbox{{product .index}}"  value = {{product .index}}{% if product .like == 1 %} checked {% else %} {% endif %}&gt;&lt;/form&gt;{{product .like}}&lt;/td&gt;
                  {% endfor %} 
  </code></pre>
  
  <p>Which populates a table depending on how many products are in the list <code>products</code>. I am then in <code>app.py</code> trying to see if any boxes are checked (which all have different names), the problem is that, if I have multiple rows which are chceked, only the first row is the one that returns a value.</p>
  
  <p><code>app.py</code></p>
  
  <pre><code>  @app.route('/', methods = ['GET', 'POST'])
    def index():
        ....
        for key in request.form:
           print(key)
    return render_template('index.html', products = products)
  </code></pre>
  
  <p>So if my list <code>products</code> contains 3 products, they will each be on one row in the table, and all have one box next to them. But when I check in all the boxes and press the update button, only the name of the first button will be printed. How do I access the value of all the buttons which are present in the table?</p>