Open Guneshj opened 1 month ago
app.post('/create', (req, res) => { //const sqll = "SELECT * FROM event WHERE
Event_name= ? AND
details` = ?";
const sql = "INSERT INTO event (`Event_name`, `details`) VALUES (?)";
const values =[
req.body.event_name,
req.body.details
]
console.log(values);
db.query(sql, [values], (err, data) => {
// if(err) return res.json("Error");
return res.json(data);
})
})`
mistakes - typos in 'creat' and Event_name where in the frontend we have initialised as event_name
### In the Frontend
function handleSubmit(event) { event.preventDefault(); axios.post('http://localhost:8081/create', {event_name, details}) .then(res => { console.log(res)}) .catch(err => console.log(err))}
remove useNavigate() it should not navigate to the other home page
After Making the changes check the table if the values or inserted properly And also send images of event_table
Check Home page code I have created code to Create new Event & also i have created a new table in DB named as 'event'. After Submitting we have to go on event page and see all details about event & created event shows in DB
please check this @OmkarS08