Get php selected checkbox values in JAVASCRIPT
<p>Im new to Javascript and i cannot solve this . I have a checkbox form , so i need to get the selected value(s) and post to a php file .</p>

<p>Here is the script :</p>

<pre><code>&lt;script&gt;
                $("#addusers").click(function(){

                    var checkedValue = null;
                    var inputElements = document.getElementsByClassName('values');
                    for(var i=0; inputElements[i]; ++i){
                        if(inputElements[i].checked){
                            checkedValue = inputElements[i].value;
                            break;
                        }
                    }

                    $.post("users_add.php", {
                        checkedValue:checkedValue

                    }, function(data) {
                        alert(data);
                    });
                });
            &lt;/script&gt;
</code></pre>

<p>Here is the php code :</p>

<pre><code>&lt;td&gt;
                                &lt;div&gt;
                                    &lt;?php
                                    foreach($userProfiles as $u)
                                    {
                                        foreach($u as $x)
                                        {
                                            echo "&lt;input type=\"checkbox\" name=\"values\"&gt; $x";
                                            echo "&lt;br&gt;";
                                        }
                                    }
                                    ?&gt;

                                &lt;/div&gt;
                            &lt;/td&gt;
</code></pre>

<p>Im checking print_r($_POST) post variables , but it isnt showing anything.
Is my javascript okay ?</p>