Skip to content
Advertisement

Insert data when selecting a dropdown option, MySQL, JAVA, JSP

well my english is not so good, but i will try to explain me, I have a question about how to make an INSERT query when selecting an option from my dropdown, I explain myself, I have a section to insert a user on my website, and an option to select a profile

enter image description here

It should be noted that my dropdown options are data from my PROFILE table

enter image description here

This is my code where I show the values ​​of my dropdown from my PROFILE table

JavaScript

what I try to do in my table USER

enter image description here

is to insert the option either EMPLOYEE or PROFILE dropdown

my INSERT query is as follows

JavaScript

I insert the other data correctly, only I need to be able to insert the values ​​of my DROPDOWN in my USER table

I don’t know if I would miss doing a JOIN to my PROFILE table in my INSERT query, in order to register the profile data to my USER table

I hope I have explained well, any help would be very important

Advertisement

Answer

You have missed the id and name of the select element. It should be as follows:

JavaScript
Advertisement