title: Form sending error, Flask
body: <p>There is form with two <code>&lt;input type="submit"&gt;</code>. But when i'm sending it, second submit causes error.</p>
  
  <p><em>layout</em>:</p>
  
  <pre><code>&lt;form action="{{ url_for('index') }}" method="post"&gt;
      &lt;input type="submit" name="add" value="Like"&gt;
      &lt;input type="submit" name="remove" value="Dislike"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><em>main.py</em>:</p>
  
  <pre><code>...
  if request.method == 'POST':
      if request.form['add']:
          return redirect(url_for('index'))
      elif request.form['remove']:
          return redirect(url_for('index'))
  ...
  </code></pre>
  
  <p>First submit(add) works well, but second(remove)...:</p>
  
  <blockquote>
    <p><strong>Bad Request</strong> The browser(or proxy) sent a request that this server could not understand.</p>
  </blockquote>
  
  <p>How can i fix this error?</p>
  
  <p><strong>UPD</strong>:</p>
  
  <p>It was pretty simple:
  request.form returns ImmutableMultiDict:</p>
  
  <pre><code>... 
  if 'Like' in request.form.values():
       ...
  elif 'Dislike' in request.form.values():
       ...
  </code></pre>