Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Mayur Pande
Mayur Pande
Courses Plus Student 11,711 Points

How would I go about storing values of radio buttons in mysql using python


So I have created a table in python which will have an id, a date and a tinyint for the value of a radio button.

I'm getting confused on how I would go about storing the value of the radio button in the db.

So in my code I would want four radio buttons with one set to default;

<form action="">
  <input type="radio" name="priority" value="one" checked> 1<br>
  <input type="radio" name="priority" value="two"> 2<br>
  <input type="radio" name="priority" value="three"> 3<br>
 <input type="radio" name="priority" value="Four">4<br> 


If I am using python flask, would this pick the default value up using the tinyint?

1 Answer

Well the request.POST will have the values that have been selected on the form.

Check This out for more info How to Get Data from flask request

create a view function to handle the request and set the form action='url_of_view_path' and method as POST