In am making a webpage in flask on which users can choose between several options. Depending on these options I want to show them their choosen options in the next page. My HTML code:
<input type="checkbox" name="name1">name1<br>
<input type="checkbox" name="name2">name2<br>
<input type="checkbox" name="name3">name3<br>
My python code:
if checkbox 1 is checked:
do something
if checkbox 2 is checked:
do something different
if checkbox 3 is checked:
do another something different
I cannot find how to form these if-statements. I found something with :
.getvalue
, but then I got an error. With radio-buttons I can get it to work. When I name them all the same and give them different values with :
option = request.form['name']
However, this does also nog work with checkboxes, as then he only remembers the last checkbox, but I want them all. Who can help me? Thank you in advance!
Aucun commentaire:
Enregistrer un commentaire