Better way to submit a form with custom variable (prompt)?
<p>I'd like to submit a form with a custom variable from the <code>prompt()</code> function.</p>

<p>Submitting a form uses the code</p>

<pre><code>document.formname.submit();
</code></pre>

<p>But that will just submit the form, what I want is:</p>

<pre><code>var iInvoiceID = prompt("Please enter the invoice ID");
document.formname.submit(); // But it should send iInvoiceID within $_POST aswell
</code></pre>

<p>One way could be: after the prompt, set an input type = 'hidden' to <code>iInvoiceID</code>'s value, and then submit the form. But is there a better/cleaner way todo this?</p>
