feedback
feedback.py
from flask import * app = Flask(__name__) @app.route("/") def home(): return render_template("feedback.html") @app.route("/details", methods=["POST"]) def capture(): transport = request.form["transport"] #radio print("transport:", transport) if "cricket" in request.form: #checkbox cricket = request.form["cricket"] print("cricket:", cricket) if "football" in request.form: #another checkbox football = request.form["football"] print("football:", football) game = request.form["game"] #select from list print("game:", game) return redirect("/") app.run(debug=True)
templates\feedback.py
<form action="/details" method="post"> <input type="radio" name="transport" value="car" checked>Car<br> <input type="radio" name="transport" value="bus">Bus<br> <input type="checkbox" name="cricket" value="cricket">Cricket<br> <input type="checkbox" name="football" value="football" checked>Football<br> <select name="game"> <option value="minecraft">Minecraft</option> <option value="fortnite">Fortnite</option> </select> <br><input type="submit" value="Submit"> </form>