i am working on a flask project.
i want to retrieve data from the form and store them in database.
but the server does not recognize the post request so i cannot retrieve or store any data
html code
<div class="container-lg p-3 border mt-6 mb-3" style="max-width: 460px;">
<form action="{{ url_for('registration') }}" method="POST" class="ui form" id="add-user">
<dl class="mt-2 form-group">
<dt><label for="name">Full Name</label></dt>
<dd>
<input
type="text"
class="form-control bg-white"
name="name"
id="name"s
placeholder="Enter your name"
required
autofocus
/>
</dd>
</dl>
<dl class="mt-2 form-group">
<dt><label for="email">Email Address</label></dt>
<dd>
<input
type="email"
class="form-control bg-white"
name="email"
id="email"
placeholder="Enter your email"
required
/>
</dd>
</dl>
<div class="mt-2 form-group bg-white" onkeydown="remove_placeholder()">
<label for="question-input-101" class="d-block mb-2">Skills</label>
<div
class="topic-input-container tag-input-container js-tag-input-container">
<div
class="tag-input form-control js-tag-input-wrapper clearfix position-relative bg-white">
<ul class="js-tag-input-selected-tags">
<li
class="d-none topic-tag-action f6 float-left js-tag-input-tag js-template">
<span class="js-placeholder-tag-name"></span>
<button
type="button"
class="delete-topic-button f5 no-underline ml-2 js-remove"
tabindex="-1">
</button>
<input
type="hidden"
name="answers[101][selections][]"
class="js-topic-input"
value=""
/>
</li>
</ul>
<auto-complete
src=""
aria-owns="tag-popup"
role="combobox"
aria-haspopup="listbox"
aria-expanded="false">
<input
type="text"
id="question-input-101"
class="tag-input-inner form-control bg-white shorter d-inline-block p-0 my-1 border-0"
autocomplete="off"
autofocus=""
aria-owns="tag-popup"
spellcheck="false"
aria-autocomplete="list"
aria-controls="tag-popup"
placeholder="Space separated"
maxlength="40"
/>
<ul
class="suggester border width-full bg-white left-0"
id="tag-popup"
style="top: 100%;"
hidden=""
role="listbox"></ul>
</auto-complete>
<input
type="hidden"
name="answers[101][choice]"
id="answers_101_choice"
value="474"
class="form-control"
/>
</div>
</div>
</div>
<p class="mt-3 note">
What languages, frameworks, technologies, or skills do you have/know?
</p>
<p class="note" style="margin-top: -6px">
e.g. html, python, machine-learning.
</p>
<button
class="btn btn-lg mt-4 btn-blue btn-block"
type="submit"
onclick="parse()">
Add yourself
</button>
<div class="ui success message">
<div class="header">Registered Successfully!</div>
<p>
Now, please check your inbox and verify your email.<br />
<b>Note:</b> You won't appear in the search results unless you
verify your email.
</p>
</div>
<div class="ui error message">
<div class="header">Something Went Wrong!</div>
<p id="error-message"></p>
</div>
</form> </prev>
i use flask and sqllite as code below
python code "register function"
@app.route("/registration", methods=["GET", "POST"])
def registration():
if request.method == "POST":
if not request.form.get("name"):
return apology("you must provide name")
elif not request.form.get("email"):
return apology("you must provide email")
elif not request.form.get("answers[101][selections][]"):
return apology("you must provide skills")
else:
name = request.form.get("name")
email = request.form.get("email")
skills = request.form.get("answers[101][selections][]")
db.execute("Insert into students(name, skills, email) Values(:name,:skills,:email)", name=name, skills=skills, email=email)
return render_template("registration.html")
else:
return render_template("registration.html")
i`v tried many things and searched for similar problems but that could not help my case
thanks in advance !
update
here is server response
* Serving Flask app "application.py" (lazy loading)
* Environment: development
* Debug mode: off
* Running on https://c4c2d2de-af5f-4a37-b685-424eae62c49b-ide.cs50.xyz:8080/ (Press CTRL+C to quit)
* Restarting with stat
INFO:werkzeug:192.168.141.75 - - [23/Dec/2019 15:13:59] "GET / HTTP/1.0" 200 -
INFO:werkzeug:192.168.141.75 - - [23/Dec/2019 15:13:59] "GET /static/css/lib/frameworks-41c2037bf12f1e46d8f08b88a04a8d8f.css HTTP/1.0" 200 -
INFO:werkzeug:192.168.114.150 - - [23/Dec/2019 15:13:59] "GET /static/css/lib/github-bb09139146955473c2e2a9015b3d8cd6.css HTTP/1.0" 200 -
INFO:werkzeug:192.168.94.189 - - [23/Dec/2019 15:13:59] "GET /static/js/lib/frameworks-369fa3dc.js HTTP/1.0" 200 -
INFO:werkzeug:192.168.152.245 - - [23/Dec/2019 15:14:00] "GET /static/js/index.js HTTP/1.0" 200 -
INFO:werkzeug:192.168.202.213 - - [23/Dec/2019 15:14:00] "GET /static/js/lib/github-bootstrap-ddb380c5.js HTTP/1.0" 200 -
INFO:werkzeug:192.168.202.213 - - [23/Dec/2019 15:14:02] "GET /registration HTTP/1.0" 200 -
INFO:werkzeug:192.168.202.213 - - [23/Dec/2019 15:14:03] "GET /static/css/lib/frameworks-41c2037bf12f1e46d8f08b88a04a8d8f.css HTTP/1.0" 200 -
INFO:werkzeug:192.168.114.150 - - [23/Dec/2019 15:14:03] "GET /static/css/lib/github-bb09139146955473c2e2a9015b3d8cd6.css HTTP/1.0" 200 -
INFO:werkzeug:192.168.94.189 - - [23/Dec/2019 15:14:03] "GET /static/css/custom.css HTTP/1.0" 200 -
INFO:werkzeug:192.168.152.245 - - [23/Dec/2019 15:14:03] "GET /static/js/lib/github-bootstrap-ddb380c5.js HTTP/1.0" 200 -
INFO:werkzeug:192.168.141.75 - - [23/Dec/2019 15:14:03] "GET /static/js/lib/frameworks-369fa3dc.js HTTP/1.0" 200 -
INFO:werkzeug:192.168.94.189 - - [23/Dec/2019 15:14:03] "GET /static/js/submit.js HTTP/1.0" 200 -
INFO:werkzeug:192.168.202.213 - - [23/Dec/2019 15:14:03] "GET /static/js/remove_placeholder.js HTTP/1.0" 200 -