Flask button passing variable back to python
<p>I've found a lot of into similar to this, but I just can't quite make it work. Basically, I've got a button, and upon pressing it, I want to fire that value back to my flask backend.</p>

<p>HTML Button:</p>

<pre><code>&lt;form action="" method="POST" &gt;&lt;button class="btn btn-danger" type="submit" name="delete" value="{{  item2  }}"&gt;&lt;span class="glyphicon glyphicon-trash"&gt;&lt;/span&gt; Delete&lt;/button&gt; &lt;/form&gt;
</code></pre>

<p>Python:</p>

<pre><code>@app.route('/', methods=["GET","POST"])
def home():    
    if request.method == 'POST':
        if request.form['delete'] == post_id:
            (my sql login/cursor stuff....)
            sql = "DELETE FROM test_table WHERE post_id = ?"
            c.execute(sql, (post_id,))
            return redirect("/")
</code></pre>

<p>As you can see, I'm populating the links (and subsequent variable) with jinja. It populated the button as it should, but sending it back to my python script isn't working. </p>

<p><strong>UPDATE:</strong>
When I run this, I get an internal server error. I cannot see what the routing error is because I can't get debug to work (using wsgi/werkzeug).</p>

<p>I think we can conclusively say is that by not defining <code>post id</code> is why it's not working. So my question is, when the button sends data BACK to python, what value (and how) does python grab? is it <code>name=</code> or <code>value=</code> or something else?</p>