我正在建立一个人们可以申请团队的网站,到目前为止一直进展顺利但是当我在一个页面上显示应用程序时,会显示出来。
(' IGN:\r\n Age:\r\n Server Proxy:\r\n Nationality:\r\n TeamSpeak?:\r\n Discord?:\r\n Twitter?:\r\n YouTube?:\r\n Requirement Option:\r\n Exceptions:\r\n Current Clans?:\r\n Why Ominous?:\r\n\t\t\t\t\t\t',)
textarea看起来像这样,
</header>
<h1>Enter Application</h1>
<form action="/memberapp" method="POST">
<textarea type="text" name="text" size="350" rows="13">
IGN:
Age:
Server Proxy:
Nationality:
TeamSpeak?:
Discord?:
Twitter?:
YouTube?:
Requirement Option:
Exceptions:
Current Clans?:
Why Ominous?:
</textarea>
<br>
<input type="submit" name="my-form" value="Submit">
我插入数据的方式如下:
text = request.form['text']
connect()
conn = sqlite3.connect("main.db")
c = conn.cursor()
c.execute("INSERT INTO memberapps VALUES(?)", (text,))
conn.commit()
conn.close()
conn = sqlite3.connect("main.db")
然而,这不是问题,最后,我展示它的方式是这样的:
conn = sqlite3.connect("main.db")
c = conn.cursor()
c.execute("SELECT * FROM memberapps")
r = c.fetchall()
conn.close()
return render_template('member-view.html', rows=r)
{% for r in rows %}
<h2>{{r}}</h2>
{% endfor %}
谢谢!