From 7b3dc06ad087626b87110fcc41e485123a2e9d6a Mon Sep 17 00:00:00 2001 From: Mohammad Rameen Date: Mon, 1 Sep 2025 03:49:16 +0530 Subject: [PATCH] Added the html forms code --- Visual Studio Code Projects/html-forms/main.py | 8 +++++++- .../html-forms/templates/index.html | 13 +++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) 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