Set different targets for form with multiple submit buttons
<p>I have a form that contains a WYSIWYG editor, and two submit buttons :</p>

<pre><code>&lt;input type='submit' name='pdf' value='PDF Preview'/&gt;
&lt;input type='submit' name='save' value='Save'/&gt;
</code></pre>

<p>"pdf" action displays the content of the editor as a PDF output. "save" action is a regular form submit. I want the PDF output to open in a new tab, and can't figure how to do that.</p>

<p>There is no "target" attribute for "input" tag. I could add a "target=_blank" to the "form" tag, but that would submit my "save" action in a new tab as well, which I don't want.</p>

<p>I tried to replace the "pdf" submit button with this :</p>

<pre><code>&lt;a href="same_page" target="_blank" onclick="submitForm();"&gt;
</code></pre>

<p>That didn't work. The form is submitted in its current tab and the new tab query receives nothing in $_POST.</p>

<p>Is there a magic trick I don't know yet ?</p>

<p><em>Note : server-side code is PHP</em></p>