title: Getting information from HTML Form with checkboxes with Python Flask
body: <p>I'm trying to dynamically create a web form with checkboxes and populate a list with the user selections.  For example if the user were to select test1 and test2 from the form, I would expect to have a list in python of ['test1', 'test2'].  </p>
  
  <p>I am using Flask w/ Jinja2 and Python.  However, when I submit the form, I receive a 400 Message (Bad Request).</p>
  
  <p>Here is the relevant Python Code.</p>
  
  <pre><code>from flask import Flask, render_template, request, redirect
  
  CASES = ['test1', 'test2', 'test3', 'test4']
  
  @app.route("/")
  def template_test():
  return render_template('template.html', title="Home")
  
  @app.route("/TestCases")
  def TestCases():
      return render_template('testcases.html', cases=CASES, title="Test Cases")
  
  @app.route("/info", methods=['POST'])
  def getinfo():
      if request.method == 'POST':
          test = request.form['checks']
          print test
          return redirect('/')
      else:
          return redirect('/')
  </code></pre>
  
  <p>Here is the relevant html code from the template (testcases.html).</p>
  
  <pre><code>&lt;form action="info" method="post" name="checks"&gt;
    {% for c in cases %}
    &lt;input type="checkbox" name={{c}} value='checks'&gt; {{c}}&lt;br&gt;
    {% endfor %}
    &lt;br&gt;
    &lt;input type="submit" value="Submit"&gt;
  </code></pre>
  
  <p></p>
  
  <p>I am not new to python, but this is my first foray using Flask and Jinja2.</p>