Send select's values in array

Posted by Ockonal on Stack Overflow See other posts from Stack Overflow or by Ockonal
Published on 2010-05-08T11:33:10Z Indexed on 2010/05/08 11:38 UTC
Read the original article Hit count: 186

Filed under:
|
|
|
|

Hello, 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]

© Stack Overflow or respective owner

Related posts about php

Related posts about html