Request.method == 'POST' does not work -- python, flask

flask
python

#1

Hi! I’m here to ask you for help…
I have tried lots of ways to get “POST /~” .
all I can get is
"GET /pay HTTP/1.1" 200 - :disappointed_relieved:

I tried to use POST in order to insert some queries to mysql database.
I cannot find where is the error since I googled this problem and have tried all the answers I could reach.

I’m really looking forward to your help…

*application.py
from flask import Flask, flash, redirect, render_template, request, session, url_for
from flaskext.mysql import MySQL
from flask_session import Session
from tempfile import mkdtemp
import os
from helpers import *
import requests
import urllib

#configure application
app = Flask(__name__)

#from cs50

mysql = MySQL()
app.config['MYSQL_DATABASE_USER']=os.getenv('C9_USER')
app.config['MYSQL_DATABSE_PASSWORD']=""
app.config['MYSQL_DATABSE_HOST']=os.getenv('IP')
app.config['MYSQL_DATABASE_DB']='tbk'
mysql.init_app(app)

#Homepage code
@app.route("/")
def index():
    return render_template("index.html")

#Other members could submit their responses
@app.route("/pay", methods = ["GET", "POST"])
def pay():
    if request.method == 'GET':
        return render_template("demo.html")
    elif request.method == 'POST':
        conn = mysql.connect()
        cursor = conn.cursor()
        cursor.execute("SELECT * FROM member")
        checkings = cursor.fetchone()
        return render_template("demo.html", checkings = checkings)
    else:
        return apology("ERROR")

@app.route("/confirm", methods = ["GET", "POST"])
def confirm():
    if request.method == "GET":
        return render_template("confirm.html")
    elif request.method == "POST":
        conn = mysql.connect()
        cursor = conn.cursor()
        if not request.form.get('membername'):
            if not request.form.get("taskname"):
                cursor.execute("SELECT * FROM check")
                results1 = cursor.fetchall()
                return render_template("confirmed.html", checkings=results1)
        else:
            mname = request.form.get('membername')
            if not request.form.get('taskname'):
                checks = ("SELECT * FROM check"
                            "WHERE member_name=%s")
                cursor.execute(checks, mname)
                results2=cursor.fetchall()
                return render_template("confirmed.html", checkings=results2)

if __name__ == "__main__":
    app.run(host='0.0.0.0', port=8080, debug=True)

*demo.html
    <!DOCTYPE html>
    <html>
    <head>
    	<meta charset="utf-8">	
    </head>
    <body>
    	<form action="{{ url_for('pay') }}" method="post">
    	 <table class="table">
    	 	<thread>
    	 	<tr>
      <th>이름</th>
      
    </tr>
    </thread>
    <tbody>
    {% for checking in checkings %}
    <tr>
    <td>{{ checking.member_name }}</td>
    </tr>
    {% endfor %}
    </tbody>
    </table> 
    </body>
    </html>

*confirm.html
    {% extends "layout.html" %}

    {% block title %}
    확인합시다
    {% endblock %}

    {% block main %}
    <form action="{{ url_for('confirm') }}" method="POST">
     <div class="mx-auto p-3 mb-4 bg-light text-info col-lg-4">
     <p class=" my-p text-center">
     아래의 검색 버튼을 눌러주세요! 입력하지 않아도 괜찮습니다. 
    </p>
    </div>
    <br>
    <div class="mx-auto p-3 mb-4 bg-light text-info col-lg-4">

        <!-- input: member_name, task_name -->    
         <fieldset>
             
                <div class="form-group">
                    <input class="form-control" name="membername" placeholder="이름" type="text"/>
                </div>
                <div class="form-group">
                    <input class="form-control" name="taskname" placeholder="항목" type="text"/>
                </div>
                <div class="form-group">
                    <button class="btn btn-outline-info btn-lg" type="submit">검색</button>
                </div>
                </fieldset>
      </div>         
    </form>
    {% endblock %}



----------

*confirmed.html
{% extends “layout.html” %}

{% block title %}
확인합시다
{% endblock %}

{% block main %}
<form action="{{ url_for('confirm') }}" method="GET">
  <table class="table">
<thread>
<tr>
  <th>기수</th>
  <th>이름</th>
  <th>항목</th>
  <th>냈다</th>
</tr>
</thread>
<tbody>
{% for checking in checkings %}
<tr>
<td>{{ checking.ordinal }}</td>
<td>{{ checking.member_name }}</td>
<td>{{ checking.task_name }}</td>
<td>{{ checking.pay }}</td>
</tr>
{% endfor %}
</tbody>
</table> 


<p> {{ mname }}</p>
 {% endblock %}