Question: I have such select list in html:

```
<input type="checkbox" name="drive_style" value=1 checked />123<br />
<input type="checkbox" name="drive_style" value=2 />123<br />
<input type="checkbox" name="drive_style" value=3 checked /> 123<br />
<input type="checkbox" name="drive_style" value=4 />123<br />
<input type="checkbox" name="drive_style" value=5 checked />123<br />

```

I have to send **values**(1, 3, ...) of **checked** boxes to the php script (I'm using ajax with jquery) like an array. Something like: **drive\_style[index]**.

```
    $.post('post_reply.php', {'drive_style'  : $('drive_style')}, function(data){
        alert(data);
    });

```

In PHP script:

```
print_r($_POST['drive_style']);

```

> 
> [object Object]
> 
> 
> 

---

**upd**:
My new code:

```
<input type="checkbox" name="drive_style[]" value=1 checked />123<br />
<input type="checkbox" name="drive_style[]" value=2 />123<br />
<input type="checkbox" name="drive_style[]" value=3 checked />123<br />
<input type="checkbox" name="drive_style[]" value=4 />123<br />
<input type="checkbox" name="drive_style[]" value=5 checked />123<br />

    $.post('post_reply.php', {'drive_style':$('input[name=drive_style]').serialize()}, function(data){
        alert(data);
    });

```

It alerts empty string.

Answer: 
```
​$(function() {
var serial = $('input[name=drive_style]').serialize();
//php -> $('input[name=drive_style[]]').serialize();
  alert( serial );
});​

```

this give you:

```
drive_style=1&drive_style=3&drive_style=5

```

but for work with php you also need to have input name like this:

```
<input type="checkbox" name="drive_style[]" value=1 checked />123<br />

```

**NOTE:** `drive_style[]`

that obviously giv you:

```
drive_style[]=1&drive_style[]=3&drive_style[]=5

```
```
<input type="checkbox" name="drive_style[key]" value=2 />123<br />

```

You'll get only checked inputs anyways.

You can get forms serialized data with

```
$('form_selector_here').serialize();

```

which is the same format used for POST and GET ( and not-checked ones won't be in there )