title: Issue about python flask login page
body: <p>My codes are running and insert the user information in the database(MySQL) but the login cannot work. These codes are bellow.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Title&lt;/title&gt;
      
  &lt;link href="https://fonts.googleapis.com/css2?family=Jost:wght@500&amp;display=swap" rel="stylesheet"&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div class="main"&gt;      
          &lt;input type="checkbox" id="chk" aria-hidden="true"&gt;
  
              &lt;div class="signup"&gt;
                  &lt;form method="post"&gt;
                      &lt;label for="chk" aria-hidden="false"&gt;Sign up&lt;/label&gt;
                      &lt;input type="text" name="txt" placeholder="User name" required=""&gt;
                      &lt;input type="text" name="email" placeholder="Email" required=""&gt;
                      &lt;input type="password" name="pswd" placeholder="Password" required=""&gt;
                      &lt;button id="button-1" onclikc="main_page()" href="/ "&gt;Sign up&lt;/button&gt;
                  &lt;/form&gt;
              &lt;/div&gt;
  
              &lt;div class="login"&gt;
                  &lt;form method="get"&gt;
                      &lt;label for="chk" aria-hidden="true"&gt;Login&lt;/label&gt;
                      &lt;input type="email" name="email_1" placeholder="Email" required=""&gt;
                      &lt;input type="password" name="pswd_1" placeholder="Password" required=""&gt;
                      &lt;button id="button-2" onclick="login()"&gt;Login&lt;/button&gt;
                  &lt;/form&gt;
              &lt;/div&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  <hr />
  <p>MYSQL CODES</p>
  <pre><code>CREATE TABLE user_table (
      id INT PRIMARY KEY AUTO_INCREMENT,
      username VARCHAR(55) NOT NULL,
      email VARCHAR(55) NOT NULL,
      userpass VARCHAR(122) NOT NULL);
  </code></pre>
  <hr />
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>from flask
  import Flask, render_template, request, redirect, session, flash, url_for, escape
  from functools
  import wraps
  from flask_mysqldb
  import MySQL
  import MySQLdb.cursors
  from sympy
  import re
  
  
  
  app = Flask(__name__, template_folder = "template")
  app.config['MYSQL_HOST'] = ''
  app.config['MYSQL_USER'] = 'user'
  app.config['MYSQL_PASSWORD'] = 'password'
  app.config['MYSQL_DB'] = 'db'
  
  mysql = MySQL(app)
  
  def register():
  
    if request.method == "POST":
    details = request.form
  username = details['txt']
  password = details['pswd']
  email = details['email']
  cur = mysql.connection.cursor()
  cur.execute("INSERT INTO user_info(username, email, userpass) VALUES (%s, %s, %s)", (username, email, password))
  
  mysql.connection.commit()
  cur.close()
  return render_template("index.html")
  
  @app.route('/', methods = ["GET", "POST"])
  def mainpage():
    return register()
  
  @app.route("/", methods = ["POST"])
  @app.route("/home", methods = ["GET"])
  def login():
    if request.method == "POST":
    email = request.form["email_1"]
  pwd = request.form["pswd_1"]
  cur = mysql.connection.cursor()
  cur.execute("select * from user_info where email=%s and userpass=%s", (email, pwd))
  data = cur.fetchone()
  
  
  if data:
    session['logged_in'] = True
  session['username'] = data["username"]
  else :
    msg = "invalid login"
  flash("yanlış bilgi!!", "error_message")
  return render_template('home.html', status = True)
  
  def is_logged_in(f):
    @wraps(f)
  def wrap( * argws, ** kwargs):
    if 'logged_in' in session:
    return f( * argws, ** kwargs)
  else :
    return redirect(url_for('login'))
  
  @app.route("/logout")
  def logout():
    session.clear()
  flash('You are now logged out', 'success')
  return redirect(url_for('login'))
  
  
  
  
  
  
  if __name__ == '__main__':
    app.secret_key = "secret_key"
  app.run(debug = True)</code></pre>
  </div>
  </div>
  </p>
  <p>Can you help me to find the error or How can i connect the another screen in after clicking to the login button. Additionally I cant fix the problems about that data duplication and any message that visualization on the html screen.</p>
  <p>Thank you :)</p>