我有两种形式,我想在提交后获取数据, 表格:
<form class="form-inline" method="POST" action="{{ url_for('results') }}">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">Please select</span>
<select name="air_port1" class="selectpicker form-control">
<option selected>Choose Airport</option>
<option value="Zurich">Zurich</option>
<option value="Basel">Basel</option>
<option value="Antalya">Antalya</option>
<option value="Goteborg">Goteborg</option>
<option value="Malmo">Malmo</option>
<option value="Stockholm">Stockholm</option>
<option value="Alicante">Alicante</option>
<option value="Almeria">Almeria</option>
<option value="Asturias">Asturias</option>
<option value="Barcelona">Barcelona</option>
<option value="Bilbao">Bilbao</option>
<option value="Fuerteventura">Fuerteventura</option>
<option value="Girona">Girona</option>
<option value="Laspalmas">Laspalmas</option>
<option value="Granada">Granada</option>
<option value="Ibiza">Ibiza</option>
<option value="Jerez">Jerez</option>
<option value="Lacoruna">Lacoruna</option>
<option value="Lapalma">Lapalma</option>
</select>
</div>
</div>
</form>
它出现两次,一次在“ air_port1”下,另一次在“ air_port2”下。 处理: *我已经尝试了一些方法,但是它总是返回None或'ImmutableMultiDict([])'
@app.route('/results')
def results():
select = request.form.get('air_port1')
print(request.args.get("air_port1"))
print(request.args.get("air_port2"))
print(request.data)
print(request.form)
return render_template("results.html")