How to perform a $_POST for this example below? <p>I have a multiple row of buttons in my javascript code which goes from A-Z:</p> <pre><code>&lt;?php $a = range("A","Z"); ?&gt; &lt;table id="answerSection"&gt; &lt;tr&gt; &lt;?php $i = 1; foreach($a as $key =&gt; $val){ if($i%7 == 1) echo"&lt;tr&gt;&lt;td&gt;"; echo"&lt;input type=\"button\" onclick=\"btnclick(this);\" value=\"$val\" id=\"answer".$val."\" name=\"answer".$val."Name\" class=\"answerBtns answers answerBtnsOff\"&gt;"; if($i%7 == 0) echo"&lt;/td&gt;&lt;/tr&gt;"; $i++; } ?&gt; &lt;/tr&gt; </code></pre> <p>Below is the javascript function where it turns on and off each individual button:</p> <pre><code>function btnclick(btn) { $(btn).toggleClass("answerBtnsOff"); $(btn).toggleClass("answerBtnsOn"); return false; } </code></pre> <p>I want to perform a $_POST so that it posts all of the buttons which has been turned on. Does anyone know how the post method should be written for this?</p>