I want to access the checkbox value form request.body in node.js. I tried logging it but the console says 'undefined.'
HTML
<label>
<input name='sell' type='checkbox' value='false' />I want to sell this photo.
</label>
Node.js
const { title, description, category, sell } = req.body;
console.log(req.body);
console.log(sell);
The other data from the request body is being logged out but the checkbox (sell) is undefined. I cannot figure out what is wrong..
Aucun commentaire:
Enregistrer un commentaire