# Inserting checkbox values into one field



## diamondrajoor (Jun 17, 2009)

hi

I have a checkboxes on my page (.aspx) like

checkbox1 - item1
checkbox2 - item2
checkbox3 - item3
etc

what i want is that when a user selects certain checkboxes
they should be inserted into a table called
customer which has fields (customer id and actions)

the data should be inserted as

customerid actions
1 item1,item2,item3
2 item1,item3
3 etc..

i.e all the values should be inserted into database into one field separated by commas.

Thanks


----------



## FordGT90Concept (Jun 17, 2009)

You'll need some JavaScript/CSS that shows and hides the table on mouse events.  You'll need to use "display: none" to hide it and "display: block" to restore it.

Something like this is your JS function to do it:

```
function ShowHide(id) {
  var e = document.getElementById(id);
  if(e.style.display == 'none')
    e.style.display = 'block';
  else
    e.style.display = 'none';
}
```

Where you want to use it, just add...

```
<a href="#" id="hideme" onmouseclick="ShowHide("hideme")>Show/Hide</a>
```


----------

