Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 341
  • Last Modified:

to set the flag for checkbox

when we select the checkbox how to set the flag in the database
0
chintamanyam
Asked:
chintamanyam
3 Solutions
 
Peter KwanCommented:
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
 
ManishLeadCommented:
You can enter value for that checkbox in database.
0
 
deeppraCommented:
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

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now