Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
How can i insert radio button values into database? 
Hi to all
I have three radio buttons .. and i want to insert one radio button values which i will click ....give me some code....

What I have tried:

<pre lang="java">if condition
Posted
Updated 9-May-19 7:50am
v2
Comments
[no name] 9-May-19 11:53am    
100 or 010 or 001.

Those are your options.
Richard MacCutchan 9-May-19 12:07pm    
Exactly the same way you insert any values into a database.

Well with very little context in your question, the only thing really to answer is how to do a database insert within java. And seeings there are at least a gazillion tutorials I will just refer you to one of these.

JDBC - Insert Records Example[^]
 
Share this answer
 
It is unclear because you did not mention where those radio buttons are coming from, are these Spring based controls, or other Java EE based HTML web pages, JSPs, or something entirely different. One way to do that is like this, java - How to get value of selected radioButton of buttonGroup - Stack Overflow[^], checking if the radio button is selected... But it can entirely depend upon your case.

All you need to do is, just capture the value for that radio button—if multiple radio buttons can be selected, then I guess you need to change the requirement from radio button to check box. Once you have the value of the radio button (or the radio button group), just save it using a normal INSERT INTO command (as Richard mentions in the comment to your question).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900