Complete the code to create a form that sends data using POST method.
<form action="/submit" method="[1]"> <input type="text" name="username"> <button type="submit">Send</button> </form>
The method attribute in the form tag specifies how to send form data. For sending data securely, POST is used.
Complete the Flask route decorator to accept POST requests from the form.
@app.route('/submit', methods=["[1]"]) def submit(): username = request.form['username'] return f"Hello, {username}!"
The route must accept POST requests to handle form submissions sent with method POST.
Fix the error in accessing form data in the Flask route.
def submit(): username = request.[1]['username'] return f"Hello, {username}!"
Form data sent via POST is accessed using request.form in Flask.
Fill both blanks to create a form with a password input and submit button.
<form action="/login" method="[1]"> <input type="[2]" name="password"> <button type="submit">Login</button> </form>
The form should use POST to send sensitive data like passwords. The input type for passwords is password to hide the characters.
Fill all three blanks to handle POST form data and return a greeting in Flask.
@app.route('/greet', methods=["[1]"]) def greet(): name = request.[2]['[3]'] return f"Welcome, {name}!"
The route must accept POST requests. Form data is accessed via request.form. The form field name is name.