My project is to create a basic website that will allow the user to pick a genre of music then guess from a clip what the song is. There is a separate question and answer page. The user chooses on the question page, and then I'm trying to request this choice on answer.py I'm having trouble getting the user's choice of song that they think is the correct one. this is the html using radio buttons. I am using flask so I've been trying to use request. Also, i think the input it receives might be a list, so whenever we use request.args or anything else keyerror always shows up. I can't post my code due to possible honor code violations but if there is any general feedback about how to approach this that would be great!
Asked
Active
Viewed 291 times
1 Answers
0
From your question it is difficult to understand what you're struggling with exactly. There are plenty of tutorials online that deal with processing forms in flask.
From your description, you'll want something like
<form ..>
<input type="radio" name="choices" id="choice1" value="choice1"> Choice 1</input>
<input type="radio" name="choices" id="choice2" value="choice2"> Choice 2</input>
...
</form>
In your flask route you can then use
choices = request.form['choices']

Till
- 313
- 2
- 11