There are two pages in my ExpressJS app. home and user. I create a form in my home.js file and a navigate user.js from this form. I can get values of input components but i can not get values of other components. How can I do that ?
home.js :
<form action="/users" method="POST">
<input id="input_name" type="text" placeholder="name" name="name">
<input id="input_pwd" type="text" placeholder="password" name="pwd">
<input id="input_mail" type="text" placeholder="mail" name="mail">
<button type="submit" name="button_name" value='register1'>register</button>
....
<div id="selection" name="selection">selection</div>
</form>
I populate selection div with user selections and I want to sent this data to server. I catch the request in my index.js
router.post('/users', function (req, res, next) {
console.log("register name : " + req.body.name);
console.log("register mail : " + req.body.mail);
console.log("register pwd : " + req.body.pwd);
console.log("register selection : " + req.body.selection);
}
I can get value of req.body.name, req.body.mail and req.body.pwd. but req.body.selection is always undefined. how can I get this value ?