diff --git a/Visual Studio Code Projects/html-forms/main.py b/Visual Studio Code Projects/html-forms/main.py index ea84db5..bfd13f8 100644 --- a/Visual Studio Code Projects/html-forms/main.py +++ b/Visual Studio Code Projects/html-forms/main.py @@ -1,4 +1,4 @@ -from flask import Flask, render_template +from flask import Flask, render_template, request app = Flask(__name__) @@ -6,5 +6,11 @@ app = Flask(__name__) def home(): return render_template("index.html") +@app.route('/login', methods=["POST"]) +def receive_data(): + name = request.form["username"] + password = request.form["password"] + return f"

Name: {name}, Password: {password}

" + if __name__ == "__main__": app.run(debug=True) \ No newline at end of file diff --git a/Visual Studio Code Projects/html-forms/templates/index.html b/Visual Studio Code Projects/html-forms/templates/index.html index 4a1e759..38be0dd 100644 --- a/Visual Studio Code Projects/html-forms/templates/index.html +++ b/Visual Studio Code Projects/html-forms/templates/index.html @@ -6,11 +6,12 @@ Title - - - - - - +
+ + + + + +
\ No newline at end of file