2021年3月17日星期三

How to pass HTML from info to MySQL database using Python?

I am using Pyhton and Flask and I am trying to pass the information from HTML form to MySQL db. I am connected to the database and I know that it works because I tried it via terminal but I am not sure how to pass information from the HTML form!? Can someone advise on this. Thanks in advance! SuYan

@app.route("/sign-up", methods=["POST"])  def signup():      title = "Sign-up"      return render_template("signup.html", title=title)      def signup():           name = request.form['name']           age = request.form['age']           pas = request.form['signup-button']          mycursor.execute("INSERT INTO person (name, age) VALUES (%s,%s)", (name, age))  db.commit()  
https://stackoverflow.com/questions/66662309/how-to-pass-html-from-info-to-mysql-database-using-python March 17, 2021 at 03:41AM

没有评论:

发表评论