I have a application build in flask (sorry I have produced a piece of code below since I am not able to put entire code here).
I need to get whatever is selected from dropdown. Below is the code in template.html where there is a dropdown. I have a name attribute here
template.html
<select name="comp_select" onchange="update_selected_option_value(value)" method="POST">
{% for ticker in tickers %}<option value="{{ticker}}" SELECTED>{{ticker}}</option>{% endfor %}
</select>
`
Now i am trying retrieve selected value so I am using below code
`
@app.route('/', methods=['GET','POST'])
def dropdown():
company_name = request.form['comp_select']
return render_template('template.html')
`
So basically i need to get selected value in company_name . But I am not able to get it. Can anyone help me what wrong I am doing?
Top comments (1)
Hi all, Here is the entire application for reference. Any help would be appreciated
stackoverflow.com/questions/741352...