我知道这个问题已经问了很多次了,但是这些答案对我没有帮助,请原谅我再次问。在
我正在获取表格中的数据索引.html页面并在下一个html页面中显示(annodisplay.html)供用户查看,然后单击“提交”。
我希望只在用户按下submit按钮时将数据传递给python变量。但是我没有得到python变量中的形式值。在
这是我的python烧瓶代码。在app = Flask(__name__)
@app.route('/send', methods=['GET', 'POST'])
def send():
if request.method == 'POST':
affflash = request.form['affflash']
return render_template('annodisplay.html', affflash=affflash)
return render_template('index.html')
@app.route('/get', methods=['GET', 'POST'])
def get():
if request.method == 'POST':
return render_template('submit.html')
return render_template('annodisplay.html')
affflash = request.form['affflash']
print affflash
if __name__ == "__main__":
app.run(debug=True)
这是我的HTML索引.html代码
^{pr2}$
这是我的annodisplay.html代码
AFF Flash | {{ affflash }} |