user3642365 user3642365 - 1 year ago 70
HTML Question

HTML form not sending data in Express

I have the following form in HTML:

<form method="post" id="registration-form" action="/register">
<div class="form-group">
<label for="UsernameRegistration">Username:</label>
<input type="text" class="form-control" id="UsernameRegistration">
<div class="form-group">
<label for="PasswordRegistration">Password:</label>
<input type="password" class="form-control" id="PasswordRegistration">
<div class="form-group">
<label for="ConfirmPasswordRegistration">Confirm Password:</label>
<input type="password" class="form-control" id="ConfirmPasswordRegistration">
<input type="submit" class="form-control" />

endpoints looks like the following:'/register', function(req, res, next) {

In req.query and req.body, there is no data. What am I doing wrong?

Answer Source
<input type="password" class="form-control" id="PasswordRegistration">

Here the attribute name is not specified. It should be like

<input type="password" name="password" class="form-control" id="PasswordRegistration">
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download