HTTP POST submits data to a server for processing. In a Flask page, a form can use POST to start an action only when the user submits it, while a normal page load uses GET. section 6.2
Starting a question session
Add a form whose action is `/` and method is `POST`. Configure the Flask route for POST and GET, then check `request.method`; start the session only for POST, and render the page for the other case. Testing exposed missing request imports and an undefined `data` value, so both required human review and correction. section 6.2
<form action="/" method="POST"> <input type="submit" value="Start Question Session"> </form>
Shows the compact HTML form that sends the POST request when the button is submitted. section 6.2
@app.route('/', methods=['POST','GET'])
def index():
# Check if the form has been submitted
if request.method == 'POST':
# Start the question session
# ...
# Return the HTML template for the index page
return render_template('index.html', data=data)
Shows the Flask route and conditional request-method check that distinguishes POST submission from GET loading. section 6.2













