Week 7 • Tuesday

Block 63: Flask: Forms & POST Requests

Handle user input from HTML forms.

Concepts

Code Examples

See exercise below.

Exercise

Build a BMI calculator: HTML form takes weight and height, Flask computes and displays BMI. Add basic validation: check that values are numeric before computing.

Homework

What is the POST/Redirect/GET pattern and why does it prevent form resubmission?