title: Flask doesn't return a boolean checkbox value
body: <p>I'm looking for a solutions for my problem from 1 weeks, but i don't understand where is the right point to change my code. I want checkbox to  return a boolean value in flask code. Below are the related code snippets:</p>
  
  <p><strong>mycode.py</strong></p>
  
  <pre><code>import os, sqlite3
  
  from flask import Flask, flash, request, render_template, send_from_directory, g, session, abort, redirect, url_for
  from random import randint
  from tkinter.messagebox import *
  
  import os, sqlite3
  
  app = Flask(__name__)
  
  app.config.from_object(__name__)
  
  @app.route('/')
  def home():
      return render_template('appvolti1.html')
  
  
  @app.route('/filter')
  def viewdb():
      global list1
      bool_occhiali_checked = request.form.get('occhiali')
  
      if bool_occhiali_checked:
          list1 = ["Hello", "World"]
      else:
          list1 = ["Oh no", "don't work"]
  
      return newpage()
  
  
  @app.route('/newpage')
  def newpage():
      return render_template('filter.html', listaimmagini = list1)
  
  
  if __name__ == '__main__':
      app.debug = True
      app.run()
  </code></pre>
  
  <p><strong>appvolti1.html</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset="UTF-8"&gt;
  &lt;title&gt;Riconoscimento volti&lt;/title&gt;
  &lt;style&gt;
  @import url(http://fonts.googleapis.com/css?family=Exo:100,200,400);
  @import url(http://fonts.googleapis.com/css?family=Source+Sans+Pro:700,400,300);
  
      body{
          background: -webkit-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.65)); /* For Safari 5.1 to 6.0 */
          background: -o-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.65)); /* For Opera 11.1 to 12.0 */
          background: -moz-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.65)); /* For Firefox 3.6 to 15 */
          background: rgb(230, 230, 230); /* Standard syntax */
  
      }
      .div1{
          margin:0 auto;
          width:1400px;
          display:block;
      }
      .subdiv1{
          display: inline-flex;
          display: -webkit-inline-flex;
          width: 100%;
      }
      .subdiv2{
          margin: 0 auto;
          display: table;
          height: 200px!important;
      }
      .subdiv3{
          width:40%;
          margin: 0 auto;
          display: table;
      }   
  
      .invia{
          display: table-cell;
          vertical-align: bottom;
          padding: 120px;/*qui gli elementi sono tutti importanti, ti ho lasciato il padding per farlo staccare dalla parte inferiore del contenitore*/
      }
  
  
      .invia input[type=button]{
          width: 160px;
          height: 35px;
          background: #597ef9;
          border: 1px silver;
          cursor: pointer;
          border-radius: 2px;
          color: #fff;
          font-family: 'Exo', sans-serif;
          font-size: 16px;
          font-weight: 400;
          padding: 6px;
          margin-top:100%;
      }
  
  
      .invia input[type=button]:hover{
      opacity: 0.8;
      }
  
      .invia input[type=button]:active{
          opacity: 0.6;
      }
  
      .invia input[type=text]:focus{
          outline: none;
          border: 1px solid rgba(255,255,255,0.9);
      }
  
  
      .invia input[type=password]:focus{
          outline: none;
          border: 1px solid rgba(255,255,255,0.9);
      }
  
  
      .invia input[type=button]:focus{
          outline: none;
      }
      .checkbox{
          margin-left: 50%;
          width: 160px;
      }
      .checkbox div{
          color: #5379fa;
          font-family: 'Exo', sans-serif;
          font-size: 15px;
          font-weight:bold;
      }
      .checkbox div span{
          color: #fff !important;
      }   
  
  
  &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div class="div1"&gt;
          &lt;div class="subdiv1"&gt;
              &lt;div class="subdiv2"&gt;
  
              &lt;div class="subdiv3" style="width:20%;margin-right:0px;"&gt;
                                  &lt;div style="position:relative;"&gt;
  
                  &lt;div class= "checkbox"&gt;
                      &lt;div&gt;&lt;span&gt;Caratteristiche&lt;/span&gt;&lt;/div&gt;
  &lt;div&gt;&lt;input type="checkbox" name="occhiali"&gt;Occhiali&lt;/div&gt; 
  
  
  &lt;/div&gt;
  
  &lt;/div&gt;
                  &lt;div class="invia" style="margin: 0 auto;" &gt;
                      &lt;input type="button" value="Applica filtri" style="margin-left: -125%;" onclick="location.href = 'http://127.0.0.1:5000/filter';"&gt; 
                  &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  
  &lt;/html&gt; 
  </code></pre>
  
  <p><strong>filter.html</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;style&gt;
      body{
  
          background: rgb(230, 230, 230); /* Standard syntax */
      }
  &lt;/style&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
    {{listaimmagini}}
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>