Issue
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")
Solution
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.
Answered By - little_birdie
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.