pass several parameters to php using js
<p>I have some problems when trying to pass some parameters to PHP via JS.</p>

<p>Here's the situation:</p>

<p>HTML:</p>

<pre><code>&lt;form id="numbtns" method="post" action="imphp.php"&gt;
  &lt;button id="1" onClick="pass(this.id)"&gt;1&lt;/button&gt;
  &lt;button id="2" onClick="pass(this.id)"&gt;2&lt;/button&gt;
  &lt;button id="3" onClick="pass(this.id)"&gt;3&lt;/button&gt;
  &lt;button id="confirm" onClick="save()"&gt;submit&lt;/button&gt;
&lt;/form&gt;
</code></pre>

<p>JS: </p>

<pre><code>pass(clicked_id) {
     var btn = document.getElementById(clicked_id);

     **// I have no idea what to do next to give the ids to the php file.**

     }

save() {
**// I want function save() to collect the parameters from function pass(), and pass      them to 'imphp.php' when submit button is clicked. I'm stuck here.**
}
</code></pre>

<p>PHP:</p>

<pre><code>// connection part, let's skip it.

...

$num = $_POST['num'];
$query = sprintf("SELECT id, num FROM tb WHERE num = $num");
</code></pre>

<p>I know maybe it's a quick and stupid question for u, but I cannot figure it out for hours. So... could anyone help me out, I'd be very appreciate that.</p>

<p>Thx in advance.</p>
