html page
{%block title%}Login page{% endblock %}
{%block content%}
<form action = '#' method="post">
<p>creds:</p>
<p><input type="number" placeholder="id" Id="id" /></p>
<p><input type="text" placeholder="nm" name="nm" /></p>
<p><input type="submit" value="submit" /></p>
</form>
{%endblock%}
app code
@app.route("/")
def home():
return render_template("login.html")
@app.route("/",methods = ["POST","GET"])
def post():
if request.method == "POST":
user = request.form['nm']
id = request.form['id']
sql = ('''INSERT INTO abc
(id, name) VALUES (?, ?)
''')
val = (id,user)
cur.execute (sql, val)
return 'Ok'
i tried using return.form.get('id') but its returning null
Can anyone please help me on this
Thanks
<p><input type="number" placeholder="id" name="id" /></p>
you have typed Id instead of name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With