flask handle form with radio buttons

前端 未结 2 916
花落未央
花落未央 2020-12-16 12:15

My index.html looks like this

2条回答
  •  猫巷女王i
    2020-12-16 12:36

    You should add the value attribute to each of your input fields:

     Option1 
    Option2
    Option3

    and in your flask route you can read the selected option:

    option = request.form['options']
    

    and you'll get the value of the selected radio button.

提交回复
热议问题