to set the flag for checkbox

when we select the checkbox how to set the flag in the database
chintamanyamAsked:
Who is Participating?
 
Peter KwanConnect With a Mentor Commented:
You can pass the checkbox value (a String for each value) to the backend and get the checked value from the request parameter or a form bean. In case more than one value is checked, you need to use an array to store them. Then you can use the passed value to set the flag in the database by a mapping (e.g. Value1->Flag1).
0
 
ManishConnect With a Mentor LeadCommented:
You can enter value for that checkbox in database.
0
 
deeppraConnect With a Mentor Commented:
u can have the same name for all the checkbox but the value should be different
like this

<input type="checkbok" value="value1" name="topics">Topic 1
<input type="checkbok" value="value2" name="topics">Topic 2
<input type="checkbok" value="value3" name="topics">Topic 3

then in u r JSP or servlet page u can get all the selected topics by using this function getParameterValues()

like this
String interested_topics[] = request.getParameterValues("topics");

So this will return all the selected items value in a String array then u can store all the values in the database
0
All Courses

From novice to tech pro — start learning today.