Answer the question
In order to leave comments, you need to log in
How to pass id via html to flask?
The question is probably very stupid)
cursor = con.execute(f"SELECT name,age,imagepath,gender,phone,timeadded,id,description,city FROM pets WHERE userid = '{current_user.id}' ")
{% for item in items %}
<div class="card card-item-01">
<div class="card__image-wrapper">
<img class="card__image" src="/static{{item[2]}}" alt="Desert" width="280" height="420">
</div>
<form method = "POST">
<div class="card__content">
<input type="text" placeholder="{{item[3]}}" name="gender">
<input type="text" placeholder="{{item[0]}}" name="name">
<input type="text" placeholder="{{item[1]}}" name="age">
<input type="text" placeholder="{{item[7]}}" name="desc">
<input type="text" placeholder="{{item[8]}}" name="city">
<input type="text" placeholder="{{item[4]}}" name="phone">
<input type="file" placeholder="" name="imagepath">
<input type="submit" name="id" value="Сохранить">
</div>
</form>
</div>
{% endfor %}
Answer the question
In order to leave comments, you need to log in
You need to add a page to the form for which you will write an endpoint, for example:
<form method="POST" action="{{ url_for('main.post_id') }}" >
@main.post_id('/id')
def post_id():
form = Form()
....
return render_template('template.html', form=form)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question