0

How to get response of radio button (if it is checked or not) and store it into mysql database using node js?

Webdevelopment

11th Mar 2020, 8:42 PM
R_N
10 Answers
+ 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
12th Mar 2020, 6:47 AM
A͢J
A͢J - avatar
+ 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.
13th Mar 2020, 9:09 AM
Calviղ
Calviղ - avatar
+ 2
You have already asked this question. https://www.sololearn.com/Discuss/2196138/?ref=app
11th Mar 2020, 8:43 PM
A͢J
A͢J - avatar
+ 2
R_Chandra How we can know without proper information. Share your code so anybody can see.
11th Mar 2020, 8:56 PM
A͢J
A͢J - avatar
+ 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.
12th Mar 2020, 5:35 AM
R_N
+ 2
R_Chandra here /submit means action where your request will go. It's not a id.
12th Mar 2020, 5:40 AM
A͢J
A͢J - avatar
+ 2
Removed "/" still getting "cannot POST /submit "
12th Mar 2020, 6:06 AM
R_N
+ 2
I have only one html file (front.htm) having radio button and submit button
12th Mar 2020, 7:37 AM
R_N
+ 1
Get method is not working
11th Mar 2020, 8:50 PM
R_N
0
Calvin Why two script is written in index.html file.? I've not used script tag in my html file. Is it necessary?
13th Mar 2020, 4:10 PM
R_N