title: PHP replacement for Javascript form auto submit and redirect
body: <p>I am using a third-party provider for taking credit card payments who requires data to be posted via a form, however the data I am passing is coming from a database not from a user filling in the form.</p>
  
  <p>At the moment, I get round this by having a page which auto submits using JavaScript but, whilst this works, it doesn't look very professional. Is there a way for PHP to post to a page which is then loaded in the browser?</p>
  
  <pre><code>&lt;body onload="document.form1.submit()"&gt;
  &lt;form method="post" action="https://payment.provider.com/Servlet" id="form1" name="form1" target="_top"&gt;
      &lt;input type="hidden" name="TRANSACTION_ID" value="&lt;?php echo $transid; ?&gt;" /&gt;
      &lt;input type="hidden" name="AMOUNT" value="&lt;?php echo $amount; ?&gt;" /&gt;
      &lt;input type="hidden" name="TERMINAL_ID" value="T04_000000000005" /&gt;
      &lt;input type="submit" value="Click if not redirected" name="submitButton" /&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>I am aware of cURL which can of course post data but it expects a response. When submitting a form, the data is posted to a page but that page is then loaded in the browser. Once the data is posted, the user needs to be taken to the third-party providers page (which uses the posted values, so I can't simply do a redirect).</p>