WEB 1.1 - Module 1: Lesson 6

Learning Outcomes 💫

By the end of this lesson, you should be able to...

Videos 🎥

Vid 1 - Using Flask's request method to work with <form> data in routes

Vid 1 - Using Flask's request method to work with <form> data in routes

Exercises 💪

Complete this repl.it challenge and submit your work.

Written Companion 🗒

<aside> 🤔 We now know how to create forms and connect them to routes using the action property—but how do we interact with the data collected from the <form>?

</aside>


<form> data can be utilized on the server-side with Flask's built-in request function. More specifically, the following two methods of request must be invoked for the following two use-cases:

<aside> 🚨 Do not be confused by the the naming of the request.form.get() method! A <form> can send information to any type of route. request.form.get() must be used to access <form> data in POST routes; no more no less. This can be quite confusing unfortunately, so just remember to use args.get() for GET requests and form.get() for POST requests.

</aside>