Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren0
How to get response of radio button (if it is checked or not) and store it into mysql database using node js?
Webdevelopment
10 Antworten
+ 4
R_Chandra Have you written your submit file where you will send data to store in database?
Check link to understand:-
https://www.sitepoint.com/forms-file-uploads-security-node-express/
https://programmingmentor.com/post/save-form-nodejs-mongodb/
“Using Node.js & Express.js to save data to MongoDB Database” by Jennifer Bland https://link.medium.com/X7nsXNzVM4
+ 3
R_Chandra
I just created a webpage run with node.js, the webpage displays simple multiple choice for submission to node.js, store on sqllite.
Check out the webpage and source codes.
https://code.sololearn.com/WAKK667qwYa5/?ref=app
https://github.com/cv2k10/radio-choices-node-submission
Go through the codes to find your solution, ask me if any of the source code you don't understand.
+ 2
You have already asked this question.
https://www.sololearn.com/Discuss/2196138/?ref=app
+ 2
R_Chandra How we can know without proper information. Share your code so anybody can see.
+ 2
app.post("/submit",function(req, res) {
console.log(req.body)
res.render('index',{title:'data saved',
message :'data saved successfully '})
})
here index is my pug file and submit is id of submit button.
+ 2
R_Chandra here /submit means action where your request will go. It's not a id.
+ 2
Removed "/" still getting "cannot POST /submit "
+ 2
I have only one html file (front.htm) having radio button and submit button
+ 1
Get method is not working
0
Calvin
Why two script is written in index.html file.?
I've not used script tag in my html file.
Is it necessary?