When I make a user in HTML type in two inputs it will either return "wrong"
or return "Your info is " + first_name +" "+ last_name
. But it keeps overwriting everything to display it how do I make it display on the current page?
Section of the code
def index():
if request.method == "POST":
# getting input with name = fname in HTML form
first_name = request.form.get("fname")
# getting input with name = lname in HTML form
last_name = request.form.get("lname")
if first_name != "Admin" or last_name != "12345":
return "WRONG"
else:
return "Your info is " + first_name +" "+ last_name
return render_template("index.html")
HTML
<form action="{{ url_for("index")}}" method="post">
<label for="firstname">First Name:</label>
<input type="text" id="firstname" name="fname" placeholder="firstname">
<label for="lastname">Last Name:</label>
<input type="text" id="lastname" name="lname" placeholder="lastname">
<button type="submit">Login</button>