By the end of this lesson, you should be able to...
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
Complete this repl.it challenge and submit your work.
<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:
request.args.get('inputNameAttribute') for GET requestsrequest.form.get('inputNameAttribute') for POST requests<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>