Answer the question
In order to leave comments, you need to log in
Why does the data from the dropdown list disappear after a post request in FLASK?
Hello.
There is a dropdown list in html template:
<label>
Выбери продавца:
<select name="seller" class="seller form-select">
<option value=""></option>
{% for name_item in name_seller %}
{% for seller in name_item %}
<option value="{{ seller }}">{{ seller }}</option>
{% endfor %}
{% endfor %}
</select>
</label>
def get_name_seller():
cursor.execute("SELECT name_seller FROM receipt GROUP BY name_seller ORDER BY name_seller")
name_sellers = cursor.fetchall()
return render_template("index.html", name_seller=name_sellers)
Answer the question
In order to leave comments, you need to log in
Because when forming a drop-down list, you do not mark the selected element in any way.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question