Hi
I need some help with getting the chosenclass value from my HTML select into my python flask SQLAlchemy data query. I'm not sure what to put in the form action to make it return the chosenclass value to app.py.
Your expertise would be appreciated. Thanks!
I need some help with getting the chosenclass value from my HTML select into my python flask SQLAlchemy data query. I'm not sure what to put in the form action to make it return the chosenclass value to app.py.
Your expertise would be appreciated. Thanks!
HTML:
<form action="." method="POST">
<select name="chosenclass" id="chosenclass">
<option value="107i am">107i am</option>
<option value="107i pm">107i pm</option>
</select><br>
<input type="submit" value="Submit">
</form>
Python:
@app.route('/', methods = ["GET", "POST"])
def Index():
all_data = Data.query.filter_by(classroom=chosenclass).all()
return render_template("index.html", students = all_data)
Last edited by a moderator: