我有一个signup.py文件,其中我编写了python脚本来访问该网页,但是每当我在网页上的注册详细信息中输入任何详细信息时,该脚本都无法正常工作。
#!/usr/bin/pythn3
import cgi, cgitb , mysql.connector
cgitb.enable()
print("Content-type:text/html")
print("")
mydb=mysql.connector.connect("root","root123","login","localhost")
mycursor=mydb.cursor()
# Create instance of FieldStorage
form = cgi.FieldStorage()
# Get data from fields
first_name = form.getvalue('email')
passwd = form.getvalue('psw')
sql="INSERT INTO log_table (email_, pass_) VALUES (%s, %s)"
val=(first_name, passwd)
mycursor.execute(sql,val)
mydb.commit()
我想将html表单的值推入数据库