我想在提交到烧瓶中的操作 url 之前保存表单数据
<form action="" method="POST">
<input type="hidden" name="PAYEE_ACCOUNT" value="U1234567">
<input type="hidden" name="PAYEE_NAME" value="Name">
<input type="text" name="PAYMENT_AMOUNT">
<input type="submit" name="PAYMENT_METHOD" />
</form>
我可以提交此表单,但我想在提交前保存表单数据
看法:
@mod.route('/payment/', methods=['GET', 'POST'])
def payment():
if request.method != "POST":
return render_template('form.html')
form = request.form
form_data = {'PAYEE_ACCOUNT': form['PAYEE_ACCOUNT'],
'PAYEE_NAME': form['PAYEE_Name'],
'PAYMENT_AMOUNT' : form['PAYMENT_AMOUNT']
}
# Save Data
import urllib
params = urllib.urlencode(form_data)
url = 'http://www.example.com'
return redirect(url, params)
请帮我