Recall & Review
beginner
What does the POST method do in an HTML form?
The POST method sends form data to the server in the request body, keeping it hidden from the URL. It's used for submitting data securely.
Click to reveal answer
beginner
In Flask, how do you access data sent by a POST form?
You use
request.form to get form data sent by POST in Flask. For example, request.form['fieldname'] retrieves the value of a form field.Click to reveal answer
beginner
Why should you use the POST method instead of GET for sensitive form data?
POST keeps data out of the URL, so sensitive info like passwords or personal details are not visible in browser history or server logs.
Click to reveal answer
beginner
What HTML attribute specifies the HTTP method for a form?
The
method attribute in the <form> tag sets the HTTP method, e.g., <form method="post">.Click to reveal answer
beginner
How do you define a route in Flask to handle POST form submissions?
Use the
@app.route decorator with methods=['POST']. For example: @app.route('/submit', methods=['POST']).Click to reveal answer
Which HTML form attribute sets the method to POST?
✗ Incorrect
The
method attribute defines the HTTP method; method="post" sets it to POST.In Flask, which object holds POST form data?
✗ Incorrect
request.form contains form data sent via POST.Why is POST preferred over GET for submitting passwords?
✗ Incorrect
POST sends data in the request body, keeping it out of the URL and browser history.
Which Flask route decorator handles POST requests?
✗ Incorrect
To handle POST, specify
methods=['POST'] in the route decorator.What does the
action attribute in a form specify?✗ Incorrect
The
action attribute sets the URL where form data is sent.Explain how to create an HTML form that sends data using POST and how to handle it in Flask.
Think about the form attributes and Flask's request object.
You got /4 concepts.
Why is it important to use POST instead of GET for submitting sensitive information in forms?
Consider how data is exposed in URLs versus request bodies.
You got /4 concepts.