Get values of multiple buttons via JQuery
<p>I want to do something when a certain button is pressed via JQuery and PHP. The problem is however, the buttons on my page are dynamically generated, all with different values. So it could be three, four buttons,...etc.</p>

<p>The two main problems are:</p>

<p>1) Only the first button is recognized by Javascript, the other don't do anything.</p>

<p>2) I can't find a way to pass the variable id with JavaScript to my PHP code.</p>

<p>An example will hopefully make the problem clear:</p>

<p><strong>HTML, the amount of buttons is unknown, all with different values:</strong></p>

<pre><code>&lt;button id='button' value='$variableid1'&gt;Do something&lt;/button&gt;
&lt;button id='button' value='$variableid6'&gt;Do something&lt;/button&gt;
&lt;button id='button' value='$variableid11'&gt;Do something&lt;/button&gt;
...
</code></pre>

<p><strong>When pressed, I tried to activate this Javascript code:</strong></p>

<pre><code> $(document).ready(function() {
   $("#button").click(function() {
    $.ajax({
        type:"POST",
        data: {clicked: ?},
        });
    });

});  
</code></pre>

<p><strong>PHP code, on the same page:</strong></p>

<pre><code>if(isset($_POST['clicked'])){

//do some stuff with the variable id.

}
</code></pre>
