When I press the start button it directs me to error.html even if I choose my skin type
from flask import Flask, render_template, request
app = Flask(__name__)
SKIN = ["Oily" , "Dry" ,"Sensitive", "Combination", "Normal"]
@app.route("/")
def index():
return render_template("index.html", skins=SKIN)
@app.route("/register", methods=["POST"])
def register():
skin = request.form.get("skin")
if not skin:
return render_template("error.html")
else:
return render_template("info.html")
CodePudding user response:
The problem I see is that your input is name="skin type"
, whereas you are checking for an input named skin
.
If you change the input to name="skin"
it should work.
I also suggest in the future that you do not use spaces in any input field names.