How to get the checkbox value

Hi i am trying to made a grossery application…
here in this application i am using checkbox for the items.
suppose there are 5 items in the page for example…
in the first checkbox let’s say tea,
2 checkbox Coffee…
3 Checbox Rice
$ checkbox Wheat

suppose a user select any of the one item which he want to purchase…

i have all these item in the item table… so by default the ruby will
generate the item id…

now what i want is that…
if a user select suppose tea to order by checking the tea checkbox…
now i want the item id of tea for the furhter use in my order table so
that the user will complete his order…

If your checkbox is named “coffee”, and the user submits the form
containing it, the result will be in params[:coffee]. You’ll get params
for all checkboxes in your form and the checked ones will have a “1” and
the unchecked a “0”.

Thorsten M. wrote:

If your checkbox is named “coffee”, and the user submits the form
containing it, the result will be in params[:coffee]. You’ll get params
for all checkboxes in your form and the checked ones will have a “1” and
the unchecked a “0”.

how i will do that if a checkbox is selected it is “1” and the unchecked
is “0”…
can you please give the code with an example…

Reinhart

after selected the multiple checkbox we have to store the value in the
order table as well as in the line_order table…

i am able to solve for the single checkbox…

the value is added into the database but how i will check if a user
order for multiple product…