<form id="form" method="post" action="/whatsapp/chat/<%=logCheck._id%>">
<input id="input" autocomplete="off" name="sentMsg"/><button>Send</button>
This form is in whatsapp.ejs file
app.post("/bunksapp/chat/:id",async(req,res)=>{
let { sentMsg } = req.body;
let {id}=req.params;
let user=await User.findById(id);
let chat0 = new Chat({
from: user.name,
message: sentMsg,
created_at: new Date()
});
chat0.save()
.then((res)=>{
console.log(res)
})
.catch((err) => {
console.log(err);
})
res.send("uploaded");
});
when submitting the form, it is giving blank value “” to sentMsg no matter what i write in the input box. plz fix this.