title: I can't get my flask user registration code to work, what i'm i doing wrong?
body: <p>i started learning flask just few days ago so i know this might not be the best code you've seen so far my main goal for now is just to get my data into the db.  find my code below</p>
  
  <pre><code>from flask import Flask, session, redirect, url_for, escape, request, render_template
  from hashlib import md5
  from dbConnect import connection
  import MySQLdb
  from MySQLdb import escape_string as thwart
  import gc
  app = Flask(__name__)
  #database conn
  conn = MySQLdb.connect(host="localhost", user="root", password="jccofficial", db="test")
  cur = conn.cursor()
  #registration handling
  @app.route('/register/', methods=["GET","POST"])
  def register_page():
  
     return render_template('register.html')
     try:
  
       if request.method == "POST":
          username  = request.form['username']
          email = request.form['email']
          password = request.form['password']
  
  
          x = cur.execute("SELECT * FROM users WHERE username = (%s)",
                        (username))
  
          if int(x) &gt; 0:
              flash("That username is already taken, please choose another")
              return render_template('register.html', form=form)
  
          else:
              cur.execute("INSERT INTO users (username,email,password,)VALUES (%s,%s,%s)", (username, email, password))
  
              conn.commit()
              flash("Thanks for registering!")
              cur.close()
              conn.close()                
              session['logged_in'] = True
              session['username'] = username
  
              return redirect(url_for('dashboard'))
  
        return render_template("register.html", form=form)
     except Exception as e:
      return(str(e))
  </code></pre>
  
  <p>I've setup and confirmed that my db is working by manually inserting data into it.However i do not know how to check that my form is actually posting the inputs.</p>