Added the html forms code
This commit is contained in:
parent
f63f2f5468
commit
7b3dc06ad0
@ -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"<h1>Name: {name}, Password: {password}</h1>"
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=True)
|
||||
@ -6,11 +6,12 @@
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
<form action="/login" method="post">
|
||||
<label>Name</label>
|
||||
<input type="text" placeholder="name">
|
||||
<input type="text" placeholder="name" name="username">
|
||||
<label>Password</label>
|
||||
<input type="text" placeholder="password">
|
||||
<input type="text" placeholder="password" name="password">
|
||||
<button type="text">Ok</button>
|
||||
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in New Issue
Block a user