I have four JCheckboxes.
I can select all four options, or three, or two or at least one.
How do I get the values stored in one single column of the MySQL database?
See my code below:
String al = "";
if(foreign.isSelected()){
al = foreign.getText();
}else if(travel.isSelected()){
al2 = travel.getText();
}else if(dang.isSelected()){
al = dang.getText();
}else if(med.isSelected()){
al = med.getText();
}
try{
String sql = "INSERT INTO employee (EmployeeID, FirstName, LastName, FlightInCharge, Allowances, Position, Salary) VALUES (?,?,?,?,?,?,?)";
PreparedStatement stt = con.prepareStatement(sql);
stt.setInt(1, id1);
stt.setString(2, fn);
stt.setString(3, ln);
stt.setString(4, fg);
stt.setString(5, al + al2);
stt.setString(6, po);
stt.setDouble(7, sa);
stt.execute();