title: Value of toggle switch in html and flask
body: <p>I am building a webapp which has a form element using a toggle switch to send an options value in Flask/Python.</p>
  
  <p>When I keep the toggle switch on, I am getting the value as expected('check) but when I keep the toggle button off and hit the submit button, I get a bad request error saying :</p>
  
  <p>Bad Request
  The browser (or proxy) sent a request that this server could not understand. </p>
  
  <p>Below is the code for the form :</p>
  
  <pre><code>&lt;form  action=" {{url_for('process_query')}}" 
  method="post"&gt;
  
  &lt;label class="switch"&gt;
  &lt;input type="checkbox" name="check" value="check"&gt; 
  &lt;span class="slider round"&gt;&lt;/span&gt;
  &lt;/label&gt;
  
  &lt;input class="input is-rounded" type="text" name="query" value=""&gt;
  
  &lt;button class="button is-rounded is-primary"&gt;Start!&lt;/button&gt;
  </code></pre>
  
  <p>Below is the code for the <em>process_query</em> function:</p>
  
  <pre><code>@app.route('/process_query', methods = ['GET', 
  'POST'])
  def process_query():
      if request.method == 'POST':
          print ("value of checkbox is " + 
                 request.form['check'])
  more code
  </code></pre>
  
  <p>Can someone please tell me why I get this error and what changes are needed in this code?</p>